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"); + }); +}