feat(db): add defaut_groupe_instructeur_id column to procedures

This commit is contained in:
Eric Leroy-Terquem 2023-03-31 15:06:21 +02:00 committed by simon lehericey
parent c02319aa56
commit cade677355
5 changed files with 22 additions and 1 deletions

View file

@ -50,6 +50,7 @@
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# canonical_procedure_id :bigint # canonical_procedure_id :bigint
# defaut_groupe_instructeur_id :bigint
# draft_revision_id :bigint # draft_revision_id :bigint
# parent_procedure_id :bigint # parent_procedure_id :bigint
# published_revision_id :bigint # published_revision_id :bigint

View file

@ -0,0 +1,7 @@
class AddDefautGroupeInstructeurIdToProcedures < ActiveRecord::Migration[6.1]
disable_ddl_transaction!
def change
add_reference :procedures, :defaut_groupe_instructeur, index: { algorithm: :concurrently }
end
end

View file

@ -0,0 +1,5 @@
class AddDefautGroupeInstructeurForeignKeyToProcedures < ActiveRecord::Migration[6.1]
def change
add_foreign_key :procedures, :groupe_instructeurs, column: :defaut_groupe_instructeur_id, validate: false
end
end

View file

@ -0,0 +1,5 @@
class ValidateAddDefautGroupeInstructeurForeignKeyToProcedures < ActiveRecord::Migration[6.1]
def change
validate_foreign_key :procedures, :groupe_instructeurs
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.define(version: 2023_03_31_075755) do ActiveRecord::Schema.define(version: 2023_03_31_125931) 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 "pgcrypto" enable_extension "pgcrypto"
@ -699,6 +699,7 @@ ActiveRecord::Schema.define(version: 2023_03_31_075755) do
t.datetime "closed_at" t.datetime "closed_at"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.string "declarative_with_state" t.string "declarative_with_state"
t.bigint "defaut_groupe_instructeur_id"
t.string "description" t.string "description"
t.string "direction" t.string "direction"
t.datetime "dossiers_count_computed_at" t.datetime "dossiers_count_computed_at"
@ -744,6 +745,7 @@ ActiveRecord::Schema.define(version: 2023_03_31_075755) do
t.bigint "zone_id" t.bigint "zone_id"
t.index ["api_particulier_sources"], name: "index_procedures_on_api_particulier_sources", using: :gin t.index ["api_particulier_sources"], name: "index_procedures_on_api_particulier_sources", using: :gin
t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state" t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state"
t.index ["defaut_groupe_instructeur_id"], name: "index_procedures_on_defaut_groupe_instructeur_id"
t.index ["draft_revision_id"], name: "index_procedures_on_draft_revision_id" t.index ["draft_revision_id"], name: "index_procedures_on_draft_revision_id"
t.index ["hidden_at"], name: "index_procedures_on_hidden_at" t.index ["hidden_at"], name: "index_procedures_on_hidden_at"
t.index ["libelle"], name: "index_procedures_on_libelle" t.index ["libelle"], name: "index_procedures_on_libelle"
@ -1019,6 +1021,7 @@ ActiveRecord::Schema.define(version: 2023_03_31_075755) do
add_foreign_key "procedure_revisions", "attestation_templates" add_foreign_key "procedure_revisions", "attestation_templates"
add_foreign_key "procedure_revisions", "dossier_submitted_messages" add_foreign_key "procedure_revisions", "dossier_submitted_messages"
add_foreign_key "procedure_revisions", "procedures" add_foreign_key "procedure_revisions", "procedures"
add_foreign_key "procedures", "groupe_instructeurs", column: "defaut_groupe_instructeur_id"
add_foreign_key "procedures", "procedure_revisions", column: "draft_revision_id" add_foreign_key "procedures", "procedure_revisions", column: "draft_revision_id"
add_foreign_key "procedures", "procedure_revisions", column: "published_revision_id" add_foreign_key "procedures", "procedure_revisions", column: "published_revision_id"
add_foreign_key "procedures", "services" add_foreign_key "procedures", "services"