diff --git a/server/migrations/20240229034214-search-query-relationship.js b/server/migrations/20240229034214-search-query-relationship.js new file mode 100644 index 000000000..7b8111122 --- /dev/null +++ b/server/migrations/20240229034214-search-query-relationship.js @@ -0,0 +1,26 @@ +'use strict'; + +module.exports = { + up: async (queryInterface, Sequelize) => { + await queryInterface.removeConstraint("search_queries", "search_queries_shareId_fkey") + await queryInterface.changeColumn("search_queries", "shareId", { + type: Sequelize.UUID, + allowNull: true, + onDelete: "SET NULL", + references: { + model: "shares", + }, + }); + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.removeConstraint("search_queries", "search_queries_shareId_fkey") + await queryInterface.changeColumn("search_queries", "shareId", { + type: Sequelize.UUID, + allowNull: true, + references: { + model: "shares", + }, + }); + } +};