Permalink
Browse files

Fix migrate down on a single migration

  • Loading branch information...
1 parent eeb4216 commit b2cb494149da7b274c58935be96d9ac369497285 @joaosa joaosa committed Dec 31, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/set.js
View
@@ -154,7 +154,7 @@ Set.prototype._migrate = function(direction, fn, migrationName){
this.pos += migrations.length;
break;
case 'down':
- migrations = this.migrations.slice(migrationPos, this.pos).reverse();
+ migrations = this.migrations.slice(migrationPos, this.pos+1).reverse();
this.pos -= migrations.length;
break;
}

2 comments on commit b2cb494

If your fire migrate down twice after migrate up (migrations array need to be initialized) pos will bet set to -1 which breaks stuff and requires manual reseting of migrations metadata.

For single migration it will down 2 migrations instead of 1 and set pos to -1

Also tests fail for me in both cases

Collaborator

joaosa replied Oct 28, 2014

Thanks for the headsup. I reverted this 'fix' on the new release.

Please sign in to comment.