add filter and cohort migrations

This commit is contained in:
lesion
2022-05-20 12:32:32 +02:00
parent 5fb6231602
commit 1751cae8a0
2 changed files with 65 additions and 0 deletions

View File

@@ -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')
}
};

View File

@@ -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')
}
}