Closed iwasrobbed closed 7 years ago
This plugin is just a connector between hapi.js and sequelize.js. Please refer to the sequelize.js docs on how to run migrations. Please have a look at: http://docs.sequelizejs.com/en/latest/docs/migrations/
For future reference, here's an example:
$ sequelize migration:create --name "addSomeGreatNewThing"
Then you'll add a migration and use the regular interface
'use strict';
module.exports = {
up: function (queryInterface, Sequelize) {
/*
Add altering commands here.
Return a promise to correctly handle asynchronicity.
Example:
return queryInterface.createTable('users', { id: Sequelize.INTEGER });
*/
return queryInterface.addColumn(
'MyTable',
'comingSoon',
{
type: Sequelize.BOOLEAN,
defaultValue: true
}
);
},
down: function (queryInterface, Sequelize) {
/*
Add reverting commands here.
Return a promise to correctly handle asynchronicity.
Example:
return queryInterface.dropTable('users');
*/
return queryInterface.removeColumn(
'MyTable',
'comingSoon'
);
}
};
Then you can run the normal commands:
$ sequelize db:migrate
$ sequelize db:migrate:undo
Thank you @iwasrobbed !
Can you give a quick example of how I would run migrations generated by the CLI using this?