s/cohort/collection

This commit is contained in:
lesion
2022-06-18 01:10:27 +02:00
parent c660bd8eb4
commit da0216a606
8 changed files with 157 additions and 133 deletions

View File

@@ -0,0 +1,30 @@
'use strict';
module.exports = {
async up (queryInterface, Sequelize) {
return Promise.all(
[
await queryInterface.renameTable('cohorts', 'collections'),
await queryInterface.renameColumn('filters', 'cohortId', 'collectionId'),
await queryInterface.changeColumn('filters', 'collectionId', {
type: Sequelize.INTEGER,
allowNull: true,
references: {
model: 'collections',
key: 'id'
},
onUpdate: 'CASCADE',
onDelete: 'SET NULL'
}),
])
},
async down (queryInterface, Sequelize) {
/**
* Add reverting commands here.
*
* Example:
* await queryInterface.dropTable('users');
*/
}
};