Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with calling persistence.migrate with no parameters #174

Open
jaylagare opened this issue Jul 22, 2015 · 0 comments
Open

Issue with calling persistence.migrate with no parameters #174

jaylagare opened this issue Jul 22, 2015 · 0 comments

Comments

@jaylagare
Copy link

Per documentation: persistence.migrate() to run migrations up to the most recent

I encountered an issue where calling persistence.migrate with no parameters didn't do anything. Checking the code of persistence.migrations.js, I found the problem where version is undefined and thus no migration is done and only the callback is called:
if (curVersion < version)
Migrator.migrateUpTo(version, callback);
else if (curVersion > version)
Migrator.migrateDownTo(version, callback);
else
callback();

Solution is to update code from:
migrate: function(version, callback) {
if ( arguments.length === 1) {
callback = version;
version = this.migrations.length-1;
}

to:
migrate: function(version, callback) {
if ( arguments.length === 1) {
callback = version;
}
if (arguments.lemgth <= 1) {
version = this.migrations.length-1;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant