gancio-upstream/server/migrations/20190605142409-create-event-notification.js

42 lines
954 B
JavaScript
Raw Normal View History

2019-06-06 23:54:32 +02:00
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('event_notification', {
eventId: {
type: Sequelize.INTEGER,
references: {
model: 'events',
key: 'id'
2019-06-09 00:45:50 +02:00
},
onDelete: 'cascade',
onUpdate: 'cascade'
2019-06-06 23:54:32 +02:00
},
notificationId: {
type: Sequelize.INTEGER,
references: {
model: 'notifications',
key: 'id'
2019-06-09 00:45:50 +02:00
},
onDelete: 'cascade',
onUpdate: 'cascade'
2019-06-06 23:54:32 +02:00
},
status: {
type: Sequelize.ENUM,
values: ['new', 'sent', 'error'],
defaultValue: 'new',
index: true
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
2019-06-07 17:02:33 +02:00
})
2019-06-06 23:54:32 +02:00
},
down: (queryInterface, Sequelize) => {
2019-06-07 17:02:33 +02:00
return queryInterface.dropTable('event_notification')
2019-06-06 23:54:32 +02:00
}
2019-06-07 17:02:33 +02:00
}