gancio-upstream/server/migrations/20190605142409-create-event-notification.js
2019-06-09 00:45:50 +02:00

41 lines
954 B
JavaScript

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('event_notification', {
eventId: {
type: Sequelize.INTEGER,
references: {
model: 'events',
key: 'id'
},
onDelete: 'cascade',
onUpdate: 'cascade'
},
notificationId: {
type: Sequelize.INTEGER,
references: {
model: 'notifications',
key: 'id'
},
onDelete: 'cascade',
onUpdate: 'cascade'
},
status: {
type: Sequelize.ENUM,
values: ['new', 'sent', 'error'],
defaultValue: 'new',
index: true
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
})
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('event_notification')
}
}