module.exports = {
up: (queryInterface, Sequelize) => {
return Promise.all([
queryInterface.changeColumn('your table name ', 'name', {
type: Sequelize.TEXT,
allowNull: true,
}, {
transaction,
})
])
},
down: (queryInterface, Sequelize) => {
return Promise.all([
queryInterface.changeColumn('your table name ', 'name', {
type: Sequelize.STRING,
allowNull: true,
}, {
transaction,
})
])
}
};
queryInterface.changeColumn('Person', 'foo', {
type: DataTypes.FLOAT,
defaultValue: 3.14,
allowNull: false
});
Project.find({ where: { title: 'aProject' } })
.on('success', function (project) {
// Check if record exists in db
if (project) {
project.update({
title: 'a very different title now'
})
.success(function () {})
}
})