Skip to content

Releases: mxriverlynn/migroose

Compatibility w/ mongoose v4.2

Choose a tag to compare

@mxriverlynn mxriverlynn released this 19 Nov 19:26

I've updated the build and testing process as well as the mongoose library version used. Migroose is now compatible with Mongoose v4.2. I have not tested it on prior versions so cannot guarantee it works with other versions of Mongoose.

Ordered Steps For All Migration API Calls

Choose a tag to compare

@mxriverlynn mxriverlynn released this 19 Mar 21:03

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.

Data Loading Rebuild

Choose a tag to compare

@mxriverlynn mxriverlynn released this 19 Mar 20:09

MAJOR BREAKING CHANGE

This version of Migroose includes a major breaking change in the way data loading works. Previously, the load steps would return a MongooseJS model for the data in question. Now, the returned structure will include a .collection for the raw MongoDB collection object, and a .documents as an array of the documents from the collection.

migration.load({
  someData: "somecollection"
});

migration.step(function(data, complete){

  // the mongodb collection
  var col = data.someData.collection;

  // the array of documents from the collection
  var docs = data.someData.documents;

  // ... do work
  complete();
});

If you are upgrading from a previous release of Migroose, you will need to upgrade your old scripts to work from this new structure. Failing to update your migrations will cause them to error when they run.

Serial Step Execution

Choose a tag to compare

@mxriverlynn mxriverlynn released this 10 Mar 03:04

This release fixes the execution of steps so that they run sequentially, instead of all at the same time. Now you can have a step that loads and modifies data, then have the next step work with the already changed information.

v0.2.1: Correcting collection drop process

Choose a tag to compare

@mxriverlynn mxriverlynn released this 06 Jan 16:44

The collection drop process has been corrected to allow dropping a collection that is not loaded in to a mongoose model.

v0.2.0: drop collections

Choose a tag to compare

@mxriverlynn mxriverlynn released this 06 Jan 15:49

Added the ability to drop collections (not just remove data from them).

// drop a list of database collections
migration.drop("somethings", "otherthings", ... "morethings");