chore(champs): replace unique index

This commit is contained in:
Paul Chavard 2024-07-16 11:12:46 +02:00
parent 583bad01d2
commit 7687b55dd1
No known key found for this signature in database
3 changed files with 16 additions and 2 deletions

View file

@ -0,0 +1,7 @@
class AddNewChampsUniqueIndex < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
add_index :champs, [:dossier_id, :stream, :stable_id, :row_id], unique: true, algorithm: :concurrently
end
end

View file

@ -0,0 +1,7 @@
class RemoveOldChampsUniqueIndex < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
remove_index :champs, [:type_de_champ_id, :dossier_id, :row_id], algorithm: :concurrently
end
end

View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2024_06_19_205011) do ActiveRecord::Schema[7.0].define(version: 2024_07_16_091043) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pg_buffercache" enable_extension "pg_buffercache"
enable_extension "pg_stat_statements" enable_extension "pg_stat_statements"
@ -267,13 +267,13 @@ ActiveRecord::Schema[7.0].define(version: 2024_06_19_205011) do
t.text "updated_by" t.text "updated_by"
t.string "value" t.string "value"
t.jsonb "value_json" t.jsonb "value_json"
t.index ["dossier_id", "stream", "stable_id", "row_id"], name: "index_champs_on_dossier_id_and_stream_and_stable_id_and_row_id", unique: true
t.index ["dossier_id"], name: "index_champs_on_dossier_id" t.index ["dossier_id"], name: "index_champs_on_dossier_id"
t.index ["etablissement_id"], name: "index_champs_on_etablissement_id" t.index ["etablissement_id"], name: "index_champs_on_etablissement_id"
t.index ["parent_id"], name: "index_champs_on_parent_id" t.index ["parent_id"], name: "index_champs_on_parent_id"
t.index ["row_id"], name: "index_champs_on_row_id" t.index ["row_id"], name: "index_champs_on_row_id"
t.index ["stable_id"], name: "index_champs_on_stable_id" t.index ["stable_id"], name: "index_champs_on_stable_id"
t.index ["type"], name: "index_champs_on_type" t.index ["type"], name: "index_champs_on_type"
t.index ["type_de_champ_id", "dossier_id", "row_id"], name: "index_champs_on_type_de_champ_id_and_dossier_id_and_row_id", unique: true
t.index ["type_de_champ_id"], name: "index_champs_on_type_de_champ_id" t.index ["type_de_champ_id"], name: "index_champs_on_type_de_champ_id"
end end