Open svkrclg opened 1 year ago
Moved to the CLI repo because the core library is not aware of the migrations (it is entirely a cli concern). We could definitely add a cli subcommand that checks this, that you could use in your start command
This is strongly related to the --dry-run
flag: https://github.com/sequelize/cli/issues/219
No, IMO. I'm talking about a logic that will terminate the app during bootup when there is a pending migration.
This is something you'll need to run before you boot your app and decide whether the app may boot based on the exit status of the cli. The core library, which you use in your app, has no knowledge of migrations. This is because you can use any migration tool, you're not limited to the sequelize cli.
Alternatively you can use child_process.exec
to run the relevant cli command from inside your app.
Depending on how --dry-run
is designed, it could cover both use cases. I did say "strongly related", not "the same as", we could also decide to go for a --check-no-pending-migrations
flag or similar.
Thanks for explanation and it make sense now. Should I start working on this feature?
We're actually planning on rewriting the CLI from scratch, so it's unlikely that we'll do much on this repository anymore
Issue Creation Checklist
Feature Description
Pending migration (if any) alert during app startup.
Describe the feature you'd like to see implemented
I checked sequelize docs but didn't find any way of getting notified if there is pending migration left. This could be useful in many ways when there are multiple devs working on the project. During app startup, upon initialization of sequelize we should check for current migrations in DB and existing migrations in the migrations folder, and upon any mismatch we throw a non-zero exit and stop the application with a message. All this can be configurable IMO.
Describe why you would like this feature to be added to Sequelize
We can have an external npm package for this, but make sense to have it here. Also, this feature is available in Ruby on Rails ActiveRecord gem.
Is this feature dialect-specific?
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the addition of this feature by adding the 👍 reaction. Comments such as "+1" will be removed.