Replies: 1 comment 5 replies
-
Per the upgrading from 2.x instructions in the readme:
Does this cover your usecase? If not, and you'd still like |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The following post and this discussion highlights the need to track DATABASE VERSION.
(Please refer to this post: https://medium.com/@smallbee/how-to-use-sequelize-sync-without-difficulties-4645a8d96841)
Consider
The first sequelize.sync() might deploy a version 1 (or x) database to a client. Dev happens, migrations are created, and models are updated. More client deployments with various versions. Now, the latest version can be achieved in 2 ways:
What is version X?? What migrations need executing? Not those prior to version X.
These pre Version X migrations are not in sequelizeMeta! - and should not be, as this Database version was installed as X.
Deprecated Solution Umzug V2 & From command:
{ from: 'MyLastVersionX-MigrationTask', to: 'MyLastVersionY-MigrationTask' }
Now the database state = the install version + migrations in sequelizeMeta
Discussion
There are - of course many solutions to this problem, but I believe that they all revolve around knowing the state of your database. In umzug's case, we are missing an indication of Initial condition onto which migrations are applied. Perhaps a database version "marker" can be inserted into sequelizeMeta, such that "pre-Marker" migrations would not be applied? Keeping umzug agnostic of the initial condition handling such as the sequelize.sync()
Personally, I can manage the problem given the From command back again. But this is an issue (per referenced article) that I think would be really good to address.
How should we handle database state management? After all, isn't that what migrations are trying to achieve in the first place?
Beta Was this translation helpful? Give feedback.
All reactions