From 06a8684bfdd4bcdbc7a971a53c89ba9fd0e75df1 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Fri, 10 Nov 2023 15:41:30 +0100 Subject: [PATCH] chore(schema): dossiers#for_procedure_preview not nullable --- ...32_alter_dossiers_for_procedure_preview_not_nullable.rb | 5 +++++ ...te_alter_dossiers_for_procedure_preview_not_nullable.rb | 7 +++++++ db/schema.rb | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20231110135532_alter_dossiers_for_procedure_preview_not_nullable.rb create mode 100644 db/migrate/20231110135533_validate_alter_dossiers_for_procedure_preview_not_nullable.rb diff --git a/db/migrate/20231110135532_alter_dossiers_for_procedure_preview_not_nullable.rb b/db/migrate/20231110135532_alter_dossiers_for_procedure_preview_not_nullable.rb new file mode 100644 index 000000000..edcce0a7b --- /dev/null +++ b/db/migrate/20231110135532_alter_dossiers_for_procedure_preview_not_nullable.rb @@ -0,0 +1,5 @@ +class AlterDossiersForProcedurePreviewNotNullable < ActiveRecord::Migration[7.0] + def change + add_check_constraint :dossiers, "for_procedure_preview IS NOT NULL", name: "dossiers_for_procedure_preview_null", validate: false + end +end diff --git a/db/migrate/20231110135533_validate_alter_dossiers_for_procedure_preview_not_nullable.rb b/db/migrate/20231110135533_validate_alter_dossiers_for_procedure_preview_not_nullable.rb new file mode 100644 index 000000000..d08246025 --- /dev/null +++ b/db/migrate/20231110135533_validate_alter_dossiers_for_procedure_preview_not_nullable.rb @@ -0,0 +1,7 @@ +class ValidateAlterDossiersForProcedurePreviewNotNullable < ActiveRecord::Migration[7.0] + def change + validate_check_constraint :dossiers, name: "dossiers_for_procedure_preview_null" + change_column_null :dossiers, :for_procedure_preview, false, false + remove_check_constraint :dossiers, name: "dossiers_for_procedure_preview_null" + end +end diff --git a/db/schema.rb b/db/schema.rb index adcff1293..9c4e8f408 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: 2023_11_07_150217) do +ActiveRecord::Schema[7.0].define(version: 2023_11_10_135533) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -402,7 +402,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_11_07_150217) do t.datetime "en_construction_at", precision: 6 t.datetime "en_construction_close_to_expiration_notice_sent_at", precision: 6 t.datetime "en_instruction_at", precision: 6 - t.boolean "for_procedure_preview", default: false + t.boolean "for_procedure_preview", default: false, null: false t.boolean "forced_groupe_instructeur", default: false, null: false t.bigint "groupe_instructeur_id" t.datetime "groupe_instructeur_updated_at", precision: 6