npx sequelize-cli migration:generate --name add-title-post-table
// with sequelize-cli installed run
// create db
npx sequelize-cli db:create
// drop db
npx sequelize-cli db:drop
// migrate db
npx sequelize-cli db:migrate
// run all seeds
npx sequelize-cli db:seed:all
queryInterface.addColumn('OrderBackups', 'my_column', {
type: Sequelize.INTEGER,
defaultValue: 0
})
npx sequelize-cli migration:generate --name migration-skeleton
queryInterface.changeColumn(
'table_name',
'Column_name',
{
type: Sequelize.TEXT,
},
),
queryInterface.sequelize.query('drop type enum_tableName_columnName;')
.then(() => queryInterface.changeColumn(
'table_name',
'column_name',
{
type: Sequelize.ENUM('value1','value2'),
},
)),
queryInterface.createTable(
'Posts',
{
title: {
type: Sequelize.DataTypes.STRING(100),
allowNull: false
}
}
);