From 1852de31dce434b1bab115421cad380a37881b51 Mon Sep 17 00:00:00 2001 From: Joey Zhou Date: Fri, 16 May 2025 16:49:46 -0700 Subject: [PATCH] feat: drop fk for feature flag events table --- ...op_feature_flag_events_subscriber_id_fk.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/db/migrations/20250516164728_drop_feature_flag_events_subscriber_id_fk.js diff --git a/src/db/migrations/20250516164728_drop_feature_flag_events_subscriber_id_fk.js b/src/db/migrations/20250516164728_drop_feature_flag_events_subscriber_id_fk.js new file mode 100644 index 00000000000..56a5626f1d2 --- /dev/null +++ b/src/db/migrations/20250516164728_drop_feature_flag_events_subscriber_id_fk.js @@ -0,0 +1,32 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +export async function up(knex) { + await knex.schema.alterTable("feature_flag_events", (table) => { + table.dropForeign( + ["created_by_subscriber_id"], + "feature_flag_events_created_by_subscriber_id_foreign", + ); + }); +} + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +export async function down(knex) { + await knex.schema.alterTable("feature_flag_events", (table) => { + table + .foreign( + "created_by_subscriber_id", + "feature_flag_events_created_by_subscriber_id_foreign", + ) + .references("id") + .inTable("subscribers"); + }); +}