From ccddf885f6adabc9d2aaf3d6e7d212738d25ce7e Mon Sep 17 00:00:00 2001 From: mfo Date: Mon, 26 Aug 2024 15:05:22 +0200 Subject: [PATCH] fix(data): add missing foreign key on production between champs.dossier_id and dossier.id, use validate: false to delay validation --- .../20240826130121_add_missing_index_champs_to_dossier.rb | 7 +++++++ db/schema.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20240826130121_add_missing_index_champs_to_dossier.rb diff --git a/db/migrate/20240826130121_add_missing_index_champs_to_dossier.rb b/db/migrate/20240826130121_add_missing_index_champs_to_dossier.rb new file mode 100644 index 00000000000..562cb1dc526 --- /dev/null +++ b/db/migrate/20240826130121_add_missing_index_champs_to_dossier.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddMissingIndexChampsToDossier < ActiveRecord::Migration[7.0] + def change + add_foreign_key :champs, :dossiers, if_not_exists: true, validate: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 90c1c10b27c..c8fc6ebfa6c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_07_29_160650) do +ActiveRecord::Schema[7.0].define(version: 2024_08_26_130121) do # These are extensions that must be enabled in order to support this database enable_extension "pg_buffercache" enable_extension "pg_stat_statements"