From 2714480e0ad148a7a0e47ab013ddc9fbcf3bc3d6 Mon Sep 17 00:00:00 2001 From: mfo Date: Thu, 19 Sep 2024 15:06:47 +0200 Subject: [PATCH] perf(idx): add missing indexes --- ...240919130107_add_missing_index_on_deleted_dossiers.rb | 9 +++++++++ ...1_add_missing_index_on_france_connect_informations.rb | 9 +++++++++ db/schema.rb | 4 +++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20240919130107_add_missing_index_on_deleted_dossiers.rb create mode 100644 db/migrate/20240919130351_add_missing_index_on_france_connect_informations.rb diff --git a/db/migrate/20240919130107_add_missing_index_on_deleted_dossiers.rb b/db/migrate/20240919130107_add_missing_index_on_deleted_dossiers.rb new file mode 100644 index 000000000..4cff22c34 --- /dev/null +++ b/db/migrate/20240919130107_add_missing_index_on_deleted_dossiers.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddMissingIndexOnDeletedDossiers < ActiveRecord::Migration[7.0] + disable_ddl_transaction! + + def change + add_index :deleted_dossiers, :user_id, algorithm: :concurrently + end +end diff --git a/db/migrate/20240919130351_add_missing_index_on_france_connect_informations.rb b/db/migrate/20240919130351_add_missing_index_on_france_connect_informations.rb new file mode 100644 index 000000000..23909ccd4 --- /dev/null +++ b/db/migrate/20240919130351_add_missing_index_on_france_connect_informations.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddMissingIndexOnFranceConnectInformations < ActiveRecord::Migration[7.0] + disable_ddl_transaction! + + def change + add_index :france_connect_informations, :france_connect_particulier_id, algorithm: :concurrently, name: 'idx_france_connect_particulier_id' + end +end diff --git a/db/schema.rb b/db/schema.rb index 7aaff86f0..257fb7e75 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_09_16_114050) do +ActiveRecord::Schema[7.0].define(version: 2024_09_19_130351) do # These are extensions that must be enabled in order to support this database enable_extension "pg_buffercache" enable_extension "pg_stat_statements" @@ -382,6 +382,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_16_114050) do t.index ["deleted_at"], name: "index_deleted_dossiers_on_deleted_at" t.index ["dossier_id"], name: "index_deleted_dossiers_on_dossier_id", unique: true t.index ["procedure_id"], name: "index_deleted_dossiers_on_procedure_id" + t.index ["user_id"], name: "index_deleted_dossiers_on_user_id" end create_table "dossier_assignments", force: :cascade do |t| @@ -718,6 +719,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_16_114050) do t.datetime "updated_at", precision: nil, null: false t.integer "user_id" t.index ["email_merge_token"], name: "index_france_connect_informations_on_email_merge_token" + t.index ["france_connect_particulier_id"], name: "idx_france_connect_particulier_id" t.index ["merge_token"], name: "index_france_connect_informations_on_merge_token" t.index ["user_id"], name: "index_france_connect_informations_on_user_id" end