seppevs / migrate-mongo

A database migration tool for MongoDB in Node
MIT License
926 stars 163 forks source link

Save migration to database #345

Closed carlos-granados closed 3 years ago

carlos-granados commented 3 years ago

If we are rolling back our code, the file with the migration may not be available. In that case we would not be able to undo the database changes by running the down() method. This PR adds a new saveFileContents option to the config. If we enable this option, the contents of the migration file will be saved into the database and will be used to run the down migrations.

See the comments in the PR for more info

This is also a first step in the implementation of a sync command that will sync your local migration files with the database, running up or down migrations as needed so that whatever is in the database matches what is described in the migration files, allowing you to change the version of your code at will

Checklist
coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling e4ebbcd81b377bb3d8c66502a4c4f4fbdb1e51fc on i6systems:save-migration-to-database into 4906ff23676ba3b2a9be219be64eb94f440db597 on seppevs:master.

coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling e4ebbcd81b377bb3d8c66502a4c4f4fbdb1e51fc on i6systems:save-migration-to-database into 4906ff23676ba3b2a9be219be64eb94f440db597 on seppevs:master.

carlos-granados commented 3 years ago

@seppevs any chance of a review on this? I want to start work on the implementation of the Sync command

carlos-granados commented 3 years ago

I would like to know if there is any intention of reviewing this with the aim of incorporating it? I want to work on the sync functionality and if this is not going in I will just work in our own fork

carlos-granados commented 3 years ago

Closed since no one seems to give a damn, we'll continue with this in our fork