From 1751cae8a06d12d6ea93e0dc08b89249788b7127 Mon Sep 17 00:00:00 2001 From: lesion Date: Fri, 20 May 2022 12:32:32 +0200 Subject: [PATCH] add filter and cohort migrations --- server/migrations/20220512195507-cohort.js | 30 +++++++++++++++++++ server/migrations/20220512195953-filter.js | 35 ++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 server/migrations/20220512195507-cohort.js create mode 100644 server/migrations/20220512195953-filter.js diff --git a/server/migrations/20220512195507-cohort.js b/server/migrations/20220512195507-cohort.js new file mode 100644 index 00000000..7e48730d --- /dev/null +++ b/server/migrations/20220512195507-cohort.js @@ -0,0 +1,30 @@ +'use strict'; + +module.exports = { + up (queryInterface, Sequelize) { + return queryInterface.createTable('cohorts', { + id: { + type: Sequelize.INTEGER, + primaryKey: true, + allowNull: false, + autoIncrement: true, + }, + name: { + type: Sequelize.STRING, + unique: true, + index: true, + allowNull: false + }, + isActor: { + type: Sequelize.BOOLEAN + }, + isTop: { + type: Sequelize.BOOLEAN + } + }) + }, + + down (queryInterface, Sequelize) { + return queryInterface.dropTable('cohorts') + } +}; diff --git a/server/migrations/20220512195953-filter.js b/server/migrations/20220512195953-filter.js new file mode 100644 index 00000000..6b04dca1 --- /dev/null +++ b/server/migrations/20220512195953-filter.js @@ -0,0 +1,35 @@ +'use strict'; + + +module.exports = { + up (queryInterface, Sequelize) { + return queryInterface.createTable('filters', { + id: { + type: Sequelize.INTEGER, + primaryKey: true, + autoIncrement: true, + }, + cohortId: { + type: Sequelize.INTEGER, + allowNull: true, + references: { + model: 'cohorts', + key: 'id' + }, + onUpdate: 'CASCADE', + onDelete: 'SET NULL' + }, + tags: { + type: Sequelize.JSON, + }, + places: { + type: Sequelize.JSON, + } + }) + }, + + down (queryInterface, _Sequelize) { + return queryInterface.dropTable('filters') + } + +} \ No newline at end of file