It seems that sequelize
is not connecting/opening the sqlite3 database file I have in the root directory of my project. The output from the sequelize -m
command says that everything was migrated just fine, but the sqlite3 database file remains empty.
{
"development": {
"username": null,
"password": null,
"database": "main",
"host": "localhost",
"dialect": "sqlite",
"storage": "../data.sqlite3"
}
}
'use strict';
module.exports = {
up: function (migration, DataTypes, done) {
migration.createTable('users', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
createdAt: {
type: DataTypes.DATE
},
updatedAt: {
type: DataTypes.DATE
},
email: {
type: DataTypes.STRING
},
password: {
type: DataTypes.STRING
}
}).complete(done);
},
down: function (migration, DataTypes, done) {
migration.dropTable('users').complete(done);
}
};
$ sequelize -m
Loaded configuration file "config/config.json".
Using environment "development".
Loaded configuration file "config/config.json".
Using environment "development".
Running migrations...
20140814210910-createUsersTable.js
Completed in 18ms
|-.
|-bin
|-config
|--config.json
|-migrations
|--20140814210910-createUsersTable.js
|-node_modules
|-server
|-tests
|-data.sqlite3
The error was the path value for storage
in config.json
.
Edited the config.json
to read:
{
"development": {
"dialect": "sqlite",
"storage": "data.sqlite3"
}
}
and it worked.