0
I’m trying to use db-migrate but I’m getting the answer, when running db-migrate up
, the mistake:
[ERROR] TypeError: Cannot read property '1' of null
at Class.parseName (/usr/local/lib/node_modules/db-migrate/lib/skeleton.js:163:17)
at Class.init (/usr/local/lib/node_modules/db-migrate/lib/migration.js:20:24)
at Class.prototype.(anonymous function) [as init] (/usr/local/lib/node_modules/db-migrate/lib/class.js:46:26)
at new Class (/usr/local/lib/node_modules/db-migrate/lib/class.js:59:17)
at /usr/local/lib/node_modules/db-migrate/lib/migration.js:339:14
at Array.map (<anonymous>)
at /usr/local/lib/node_modules/db-migrate/lib/migration.js:338:35
at FSReqWrap.oncomplete (fs.js:135:15)
the database.json file looks like this:
{
"dev": {
"driver": {"ENV": "DRIVER"},
"user": {"ENV": "USERDB"},
"password": {"ENV": "PASSWORDDB"},
"host": {"ENV": "HOSTDB"},
"database": {"ENV": "DATABASE"},
"multipleStatements": true
}
}
and the file . env contains the correct keys to access the database, in case DRIVER="mysql".
I tried to create Migrations with db-migrate create add-table-people --sql-file
and fill in the . sql files and it didn’t work, also tried with db-migrate create add-table-people
where the file contains the up function:
exports.up = function(db) {
db.createTable("teste", {
"id": {
"type": "int",
"primaryKey": true,
"autoIncrement": true
}
});
};
I’m trying to follow this tutorial https://db-migrate.readthedocs.io/en/latest/
Hi @Paula. Did you find out what was causing this error? It’s happening the same here with me.
– L. Holanda