-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expects a migration to only be able to run once #1068
Comments
I agree with this @henninghall , there should also be a way to rollback the migration to undo the changes that just took place. |
This a problem for me as well. Not having this functionality does not give me confidence in being able to rollback effectively |
I put in place a manual setup for this, added a fingerprint function that I run on each migration, made a single content-type with one entry (but could be diff for diff usage) called migration-tracking, then have every migration .js file do a migration.transformEntriesForLocale that adds the name of the migration to the list on the entry. But it throws an error if the name is in the list, so by throwing within a sync call -- it will auto hook into the migrations cli dry-run verification |
so the entity is just a symbol list and a name, I did make from the mgmt api, so I could make the tracker name able to be an easy lookup -- but I was modelling it after the efcore migrations Microsoft does, would be nice to spawn an up/down system though -- to allow for rolling them back |
🧟 I've had success in other projects using https://github.com/sequelize/umzug, which provides a generic, agnostic framework for running migrations. I can't imagine it would be too much work to build a Contentful-specific store or for users to BYOD. |
Expected Behavior
When I run the same migration multiple times I expect it to throw an error saying that this migration has already been run.
Actual Behavior
It does try to run the migration multiple times. It usually doesn't succeed but because of other reasons, for instance that the field already exists.
Possible Solution
This other less popular library contentful-migrate is handling this, I think by creating a migration entry in contentful itself for each migration that has been run.
Does a solution already exist for this?
Steps to Reproduce
Environment
The text was updated successfully, but these errors were encountered: