[model] migrations setup
This commit is contained in:
40
server/migrations/20191025152224-event_notifications.js
Normal file
40
server/migrations/20191025152224-event_notifications.js
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.createTable('event_notifications', {
|
||||
createdAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
},
|
||||
updatedAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
},
|
||||
eventId: {
|
||||
type: Sequelize.INTEGER,
|
||||
primaryKey: true,
|
||||
references: {
|
||||
model: 'events',
|
||||
key: 'id',
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
notificationId: {
|
||||
primaryKey: true,
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'notifications',
|
||||
key: 'id',
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE',
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.dropTable('event_notifications')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user