Auto-Create Migrations
I know this has been discussed before, but it would be really helpful if sequelize could auto-create migration scripts based on differences in sequelizer and the database. I currently have a [fork I'm testing out](https://github.com/sequelize/cli/compare/master...jgr3go:auto-migrate?expand=1) that attempts to solve this issue, and I wanted to open up the discussion again to make sure this would be accepted by sequelize/the community. Right now the rules put into place for `sequelize migration:create:auto` does the following (note, this treats sequelize as _canon_, so it will attempt to resolve the migrations to create a state in the database that matches sequelizer imports): 1. Read model.js files from a new `config/models.json`, and import the model/column definitions into sequelizer. 2. Read all tables from the database and import the model/column definitions 3. Compare: - If a column exists in the database and not sequelizer, create `removeColumn()` migration - If a column exists in sequelizer and not database, create `addColumn()` migration - If a table exists in database and not in sequelizer, print a WARNING, unless `--drop` flag is present, in which case create a `dropTable()` migration - If a table exists in sequelizer and not database, do nothing. It's currently assumed sequelizer.sync() will take care of this. 4. Keep track of auto-migrations by filename convention: `{timestamp}-{model}-auto-{version}`, e.g. `20160129135511-users-auto-0002.js` . If
Posted by jgr3go on Jan 29, 2016, 8:10 PM
Tags
Related issues
- [Meta] Feedback on granular control over Copilot changes
- unexpected status 401 Unauthorized issue
- [MODEL] Measurable quality regression in Claude generation 5 (Fable 5 / Opus 5 / Sonnet 5): worse nonsense detection, ~2x verbosity, under-disclosed model fallb
- [CRITICAL] Subagent spawning and subagent pattern bugs trigger infinite recursion, infinite token usage, grossly inefficient token usage, and lost accumulated s
- Video stops playing after some minutes
- [MODEL] Claude verbose code comments by default — ignores instructions to stop.
Raise real-world problems, find people facing the same issue, and discuss solutions.5,000 issues0 comments
github (Software)
[Meta] Feedback on granular control over Copilot changes
unexpected status 401 Unauthorized issue
[MODEL] Measurable quality regression in Claude generation 5 (Fable 5 / Opus 5 / Sonnet 5): worse nonsense detection, ~2x verbosity, under-disclosed model fallb
[CRITICAL] Subagent spawning and subagent pattern bugs trigger infinite recursion, infinite token usage, grossly inefficient token usage, and lost accumulated s
Video stops playing after some minutes
[MODEL] Claude verbose code comments by default — ignores instructions to stop.
Scope Codex VS Code chats to the current workspace/project
Update on "Co-authored-by: Copilot" in commit messages
Auto-Create Migrations
I know this has been discussed before, but it would be really helpful if sequelize could auto-create migration scripts based on differences in sequelizer and the database. I currently have a [fork I'm testing out](https://github.com/sequelize/cli/compare/master...jgr3go:auto-migrate?expand=1) that attempts to solve this issue, and I wanted to open up the discussion again to make sure this would be accepted by sequelize/the community. Right now the rules put into place for `sequelize migration:create:auto` does the following (note, this treats sequelize as _canon_, so it will attempt to resolve the migrations to create a state in the database that matches sequelizer imports): 1. Read model.js files from a new `config/models.json`, and import the model/column definitions into sequelizer. 2. Read all tables from the database and import the model/column definitions 3. Compare: - If a column exists in the database and not sequelizer, create `removeColumn()` migration - If a column exists in sequelizer and not database, create `addColumn()` migration - If a table exists in database and not in sequelizer, print a WARNING, unless `--drop` flag is present, in which case create a `dropTable()` migration - If a table exists in sequelizer and not database, do nothing. It's currently assumed sequelizer.sync() will take care of this. 4. Keep track of auto-migrations by filename convention: `{timestamp}-{model}-auto-{version}`, e.g. `20160129135511-users-auto-0002.js` . If
Comments (0)
No comments yet. Start the discussion.