gancio/server/migrations/20191025152224-event_notifications.js

47 lines
1 KiB
JavaScript
Raw Normal View History

2019-10-28 17:33:20 +01:00
'use strict'
2019-10-25 18:43:49 +02:00
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('event_notifications', {
status: {
type: Sequelize.ENUM,
2021-12-07 23:53:35 +01:00
values: ['new', 'sent', 'error', 'sending'],
defaultValue: 'new',
index: true
},
2019-10-25 18:43:49 +02:00
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
},
eventId: {
type: Sequelize.INTEGER,
primaryKey: true,
references: {
model: 'events',
2019-10-28 17:33:20 +01:00
key: 'id'
2019-10-25 18:43:49 +02:00
},
onUpdate: 'CASCADE',
2019-10-28 17:33:20 +01:00
onDelete: 'CASCADE'
2019-10-25 18:43:49 +02:00
},
notificationId: {
primaryKey: true,
type: Sequelize.INTEGER,
references: {
model: 'notifications',
2019-10-28 17:33:20 +01:00
key: 'id'
2019-10-25 18:43:49 +02:00
},
onUpdate: 'CASCADE',
2019-10-28 17:33:20 +01:00
onDelete: 'CASCADE'
2019-10-25 18:43:49 +02:00
}
})
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('event_notifications')
}
}