Migrations fail after upgrade to Meteor 1.2
workflow opened this issue · 8 comments
First of all, I love having this package and we couldn't live without it, thank you! :)
So after upgrading to Meteor 1.2, I'm seeing the following fatal error when trying to run Migrations.migrateTo('latest');
, regardless of the migration actually defined:
W20151005-01:08:35.797(2)? (STDERR)
W20151005-01:08:35.797(2)? (STDERR) /home/farlion/.meteor/packages/meteor-tool/.1.1.9.7in8iw++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20151005-01:08:35.797(2)? (STDERR) throw(ex);
W20151005-01:08:35.797(2)? (STDERR) ^
W20151005-01:08:35.803(2)? (STDERR) TypeError: Cannot call method 'info' of undefined
W20151005-01:08:35.803(2)? (STDERR) at Object.Migrations._migrateTo (meteor://💻app/packages/percolate_migrations/migrations_server.js:161:1)
W20151005-01:08:35.803(2)? (STDERR) at Object.Migrations.migrateTo (meteor://💻app/packages/percolate_migrations/migrations_server.js:139:1)
W20151005-01:08:35.803(2)? (STDERR) at meteor://💻app/server/migrations/migrate.js:3:1
W20151005-01:08:35.803(2)? (STDERR) at meteor://💻app/server/migrations/migrate.js:4:1
W20151005-01:08:35.803(2)? (STDERR) at /home/farlion/code/dropz/platform/dropz/web/.meteor/local/build/programs/server/boot.js:242:10
W20151005-01:08:35.803(2)? (STDERR) at Array.forEach (native)
W20151005-01:08:35.804(2)? (STDERR) at Function._.each._.forEach (/home/farlion/.meteor/packages/meteor-tool/.1.1.9.7in8iw++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20151005-01:08:35.804(2)? (STDERR) at /home/farlion/code/dropz/platform/dropz/web/.meteor/local/build/programs/server/boot.js:137:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
The following line in migrations_server.js
is throwing the error, it seems that the log
variable is undefined for some reasons:
161 log.info('Not migrating, control is locked.');
Here's the output of meteor list | grep "log\|migrat"
for that project
logging 1.0.8 Logging facility.
percolate:migrations 0.9.6 Define and run db migrations.
Any ideas what might be going on?
Pretty obvious since the logging change was added in 0.9.6
, but just for the record: The error disappears and all works fine when using 0.8.6
.
@workflow How did you solve this? I'm also having this problem.
Can someone send me a repo with a reproduction please. I just updated the example to 1.2 in a43c945 and I'm not seeing the issue. A fork of the package with the example modified to exhibit the problem may be helpful.
Caught the culprit.
It happens when I run Migrations.migrateTo()
outside of Meteor.startup()
.
Here's a reproduction patch on the example:
diff --git a/example/example.js b/example/example.js
index 1879acc..66f1048 100644
--- a/example/example.js
+++ b/example/example.js
@@ -23,8 +23,6 @@ if (Meteor.isServer) {
up: function() {console.log('Inside migrations');}
});
- Meteor.startup(function () {
// code to run on server at startup
Migrations.migrateTo('latest');
- });
}
If this is intentional, then maybe we could document it in the Readme?
thanks!
I have followed the example from the instructions, including the Migrations.migrateTo('latest')
in Meteor.startup()
, but still get the same error on Meteor 1.2.1:
Migrations: Not migrating, control is locked.
meteor list
:
logging 1.0.8 Logging facility.
percolate:migrations 0.9.7 Define and run db migrations.
The instructions for unlocking the control helped.