fix: Missing cascade constraints on stars table
This commit is contained in:
26
server/migrations/20221230234256-add-stars-cascade.js
Normal file
26
server/migrations/20221230234256-add-stars-cascade.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
up: async (queryInterface, Sequelize) => {
|
||||||
|
await queryInterface.removeConstraint("stars", "stars_collectionId_fkey")
|
||||||
|
await queryInterface.changeColumn("stars", "collectionId", {
|
||||||
|
type: Sequelize.UUID,
|
||||||
|
allowNull: true,
|
||||||
|
onDelete: "cascade",
|
||||||
|
references: {
|
||||||
|
model: "collections",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
down: async (queryInterface, Sequelize) => {
|
||||||
|
await queryInterface.removeConstraint("stars", "stars_collectionId_fkey")
|
||||||
|
await queryInterface.changeColumn("stars", "collectionId", {
|
||||||
|
type: Sequelize.UUID,
|
||||||
|
allowNull: true,
|
||||||
|
references: {
|
||||||
|
model: "collections",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user