How can I add data to a table in a Sequelize migration script? This is what I got:
module.exports = {
up: function(migration, DataTypes, done) {
migration.cr
Actually it is not a good idea to just run a query. queryInterface has create() and bulkCreate() now.
'use strict';
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.bulkInsert('roles', [{
label: 'user',
createdAt: new Date(),
updatedAt: new Date()
}, {
label: 'admin',
createdAt: new Date(),
updatedAt: new Date()
}]);
},
down: function(queryInterface, Sequelize) {
return queryInterface.bulkDelete('roles', null, {});
}
};
This returns a promise as expected by sequelize-cli.
Source (adapted): https://github.com/sequelize/sequelize/issues/3210