Skip to content

Instantly share code, notes, and snippets.

@amandeepmittal
Created December 3, 2018 04:35
Show Gist options
  • Save amandeepmittal/97b48e439fcc66436d8d74972e50fa6e to your computer and use it in GitHub Desktop.
Save amandeepmittal/97b48e439fcc66436d8d74972e50fa6e to your computer and use it in GitHub Desktop.
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('TodoItems', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
content: {
type: Sequelize.STRING
},
complete: {
type: Sequelize.BOOLEAN,
defaultValue: false
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
},
todoId: {
type: Sequelize.INTEGER,
onDelete: 'CASCADE',
references: {
model: 'Todos',
key: 'id',
as: 'todoId'
}
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('TodoItems');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment