fix(schema): add missing index exports#instructeur_id
This commit is contained in:
parent
f972d36f2f
commit
bb4a2b84b9
3 changed files with 23 additions and 1 deletions
|
@ -1,11 +1,17 @@
|
|||
class AddInstructeurForeignKeyToExports < ActiveRecord::Migration[7.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
def up
|
||||
# Foreign keys were already added on developer machines, but timeouted in production.
|
||||
if !foreign_key_exists?(:exports, :instructeurs)
|
||||
add_foreign_key :exports, :instructeurs, validate: false
|
||||
validate_foreign_key :exports, :instructeurs
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
if foreign_key_exists?(:exports, :instructeurs)
|
||||
remove_foreign_key :exports, :instructeurs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
class AddMissingExportsInstructeurIndex < ActiveRecord::Migration[7.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
if !index_exists?(:exports, :instructeur_id) # index may have already been added on other environments by a previous migration
|
||||
add_index :exports, :instructeur_id, algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
if index_exists?(:exports, :instructeur_id)
|
||||
remove_index :exports, :instructeur_id
|
||||
end
|
||||
end
|
||||
end
|
|
@ -556,6 +556,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_11_14_113317) do
|
|||
t.string "statut", default: "tous"
|
||||
t.string "time_span_type", default: "everything", null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
t.index ["instructeur_id"], name: "index_exports_on_instructeur_id"
|
||||
t.index ["key"], name: "index_exports_on_key"
|
||||
t.index ["procedure_presentation_id"], name: "index_exports_on_procedure_presentation_id"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue