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', {
|
2019-10-30 15:22:41 +01:00
|
|
|
status: {
|
|
|
|
type: Sequelize.ENUM,
|
2021-12-07 23:53:35 +01:00
|
|
|
values: ['new', 'sent', 'error', 'sending'],
|
2019-10-30 15:22:41 +01:00
|
|
|
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')
|
|
|
|
}
|
|
|
|
}
|