Ordered Steps For All Migration API Calls
MAJOR BREAKING CHANGE
With this release of Migroose, all migration API calls become ordered steps. That is, each action you want to take will be done in the order that you call those actions.
For example:
migration.load({
foo: "foocollection"
});
migration.step(function(data, done){
// use data here
done();
});
migration.drop("foocollection");This migration will properly load the "foocollection" of documents, run the custom migration step and then drop the "foocollection" collection from the database.
However, if you change the order of these migration actions:
migration.drop("foocollection");
migration.load({
foo: "foocollection"
});
migration.step(function(data, done){
// use data here
done();
});In this version of the migration, there will be no data to load because the data was dropped as the first step.
As a suggested order to start with, run migration actions in this sequence:
- Load Data
- Custom Steps
- Remove Documents
- Drop Collections
You are free to run them in any order you wish, and may find it useful to run them in other sequences.