I've just installed the nodejs package db-migrate into an existing nodejs project. Everything seems to be configured correctly in regards to the connection to the DB.
Database.json:
{
"development": "postgres://blabla",
"production": "postgres://blabla"
}
Migration:
var dbm = global.dbm || require('db-migrate');
var type = dbm.dataType;
exports.up = function(db, callback) {
db.createTable('users', {
id: { type: 'int', primaryKey: true, autoIncrement: true },
username: { type: 'string', unique: true }
}, callback);
};
exports.down = function(db, callback) {
db.dropTable('users', callback);
};
Whenever I try to run db-migrate up
(with any variation of parameters like specifying the database file, the migration, the number of migrations, etc), the command raises an error every time:
[ERROR] TypeError: Cannot read property '1' of null
at Class.extend.parseName (C:\Users\test\Projects\nodejs\cirio-crm\node_modules\db-migrate\lib\skeleton.js:162:17)
at Class.Skeleton.extend.init (C:\Users\test\Projects\nodejs\cirio-crm\node_modules\db-migrate\lib\migration.js:35:24)
at Class.prototype.(anonymous function) [as init] (C:\Users\test\Projects\nodejs\cirio-crm\node_modules\db-migrate\lib\class.js:36:24)
at new Class (C:\Users\test\Projects\nodejs\cirio-crm\node_modules\db-migrate\lib\class.js:49:17)
at C:\Users\test\Projects\nodejs\cirio-crm\node_modules\db-migrate\lib\migration.js:312:14
at Array.map (native)
at C:\Users\test\Projects\nodejs\cirio-crm\node_modules\db-migrate\lib\migration.js:311:35
at FSReqWrap.oncomplete (fs.js:95:15)
I've tried renaming the table, changing the fields, messing with the CRLF line endings, installing different versions of nodejs and db-migrate, etc.
Any ideas?