Skip to content

Ordered Steps For All Migration API Calls

Choose a tag to compare

@mxriverlynn mxriverlynn released this 19 Mar 21:03
· 4 commits to master since this release

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:

  1. Load Data
  2. Custom Steps
  3. Remove Documents
  4. Drop Collections

You are free to run them in any order you wish, and may find it useful to run them in other sequences.