migrateTo doesn't work if migration versions aren't consecutive
Closed this issue · 4 comments
I have migrations versioned rails-style by timestamps. There's 8 migrations so far. My 8th migration version is 1454599427. If I do Migrations.migrateTo('1454599427,rerun') (passing parameters as a string is extremely lame btw), I get 'no method up() for undefined'. Reason is migrations is taken from list by index 1454599427, and real index is 8. If I do Migrations.migrateTo('8,rerun'), it works.
I propose to change getting by index implementation to at least finding by {version: ...} implementation which won't harm performance at all: suppose you have enterprise-grade Meteor project (is it real?) with 1000 migrations, your fetch will look like O(1000) loop. Not an issue as it still very fast and is run only by developer anyways.
If you're ok with this, let me make a pull request.
As an alternative there can be additional object that keeps indexed migrations (as you need this array anyways I suppose for its ordering)
I'm seeing this too. We're using date+time as the migration version and as a result we're unable to use the rerun functionality at this time.
To reduce conflicts in migration version numbers we also use timestamps as a version number, we'd also like to rerun migrations using the version number instead of the index.
Package looks abandoned. Unsubscribing from issue.