From 5c6c1485c6a27c19d0bef08920eb9c6b73e0217f Mon Sep 17 00:00:00 2001 From: Billy Stalnaker Date: Mon, 24 Mar 2025 15:16:18 -0400 Subject: [PATCH] correct migration Signed-off-by: Billy Stalnaker --- .../migrations/20250317_addTopic.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/notifications-backend/migrations/20250317_addTopic.js b/plugins/notifications-backend/migrations/20250317_addTopic.js index 3a21ee13cb..c0010ee096 100644 --- a/plugins/notifications-backend/migrations/20250317_addTopic.js +++ b/plugins/notifications-backend/migrations/20250317_addTopic.js @@ -18,9 +18,9 @@ exports.up = async function up(knex) { table.string('topic', 255).nullable().after('origin'); }); - await knex.raw( - 'ALTER TABLE user_settings DROP CONSTRAINT user_settings_unique_idx', - ); + await knex.schema.table('user_settings', table => { + table.dropUnique(['user', 'channel', 'origin']); + }); await knex.schema.alterTable('user_settings', table => { table.unique(['user', 'channel', 'origin', 'topic'], { @@ -30,9 +30,9 @@ exports.up = async function up(knex) { }; exports.down = async function down(knex) { - await knex.raw( - 'ALTER TABLE user_settings DROP CONSTRAINT user_settings_unique_idx', - ); + await knex.schema.table('user_settings', table => { + table.dropUnique(['user', 'channel', 'origin', 'topic']); + }); await knex.schema.alterTable('user_settings', table => { table.dropColumn('topic');