From 24b5c99553c0ba019aa1f223466fef895349d07e Mon Sep 17 00:00:00 2001 From: Christian Hofmaier Date: Wed, 3 Apr 2019 01:26:36 +0000 Subject: [eventmanager] fix configId reference in migration --- server/migrations/20190226151600-create-event.js | 5 +---- server/migrations/20190402032400-add-configid-event.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 server/migrations/20190402032400-add-configid-event.js (limited to 'server/migrations') diff --git a/server/migrations/20190226151600-create-event.js b/server/migrations/20190226151600-create-event.js index 59cab86..502bf44 100644 --- a/server/migrations/20190226151600-create-event.js +++ b/server/migrations/20190226151600-create-event.js @@ -14,9 +14,6 @@ module.exports = { description: { type: Sequelize.STRING(2048) }, - config: { - type: Sequelize.INTEGER - }, times: { type: Sequelize.STRING(4096) }, @@ -26,6 +23,6 @@ module.exports = { }) }, down: (queryInterface, Sequelize) => { - return queryInterface.dropTable('permissions') + return queryInterface.dropTable('events') } } diff --git a/server/migrations/20190402032400-add-configid-event.js b/server/migrations/20190402032400-add-configid-event.js new file mode 100644 index 0000000..fa44b52 --- /dev/null +++ b/server/migrations/20190402032400-add-configid-event.js @@ -0,0 +1,16 @@ +'use strict' +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.addColumn('events', 'configId', { + type: Sequelize.INTEGER, + onDelete: 'SET NULL', + references: { + model: 'configs', + key: 'id' + } + }) + }, + down: (queryInterface, Sequelize) => { + return queryInterface.removeColumn('events', 'configId') + } +} -- cgit v1.2.3-55-g7522