From c829774ed5a028cf3147e0a6a709f5cd76257f17 Mon Sep 17 00:00:00 2001 From: Kara Diaby Date: Tue, 14 Nov 2023 14:21:38 +0000 Subject: [PATCH] Migration --- app/models/individual.rb | 5 ++++ ..._combine_dossier_and_individual_updates.rb | 12 ++++++++++ db/schema.rb | 24 ++++++++++++++----- 3 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20231114140154_combine_dossier_and_individual_updates.rb diff --git a/app/models/individual.rb b/app/models/individual.rb index 7f1c40c8616..465c3e3048d 100644 --- a/app/models/individual.rb +++ b/app/models/individual.rb @@ -9,6 +9,11 @@ class Individual < ApplicationRecord GENDER_MALE = "M." GENDER_FEMALE = 'Mme' + enum notification_method: { + email: 'email', + no_notification: 'no_notification' + } + def self.from_france_connect(fc_information) new( nom: fc_information.family_name, diff --git a/db/migrate/20231114140154_combine_dossier_and_individual_updates.rb b/db/migrate/20231114140154_combine_dossier_and_individual_updates.rb new file mode 100644 index 00000000000..69dca823252 --- /dev/null +++ b/db/migrate/20231114140154_combine_dossier_and_individual_updates.rb @@ -0,0 +1,12 @@ +class CombineDossierAndIndividualUpdates < ActiveRecord::Migration[7.0] + disable_ddl_transaction! + def change + add_column :dossiers, :mandataire_first_name, :string + add_column :dossiers, :mandataire_last_name, :string + add_column :dossiers, :for_tiers, :boolean, default: false, null: false + + add_column :individuals, :notification_method, :string + add_column :individuals, :email, :string + add_index :individuals, :email, algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index fd9d97f2c81..a2874361f8d 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_14_113317) do +ActiveRecord::Schema[7.0].define(version: 2023_11_14_140154) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -417,6 +417,7 @@ t.datetime "en_construction_close_to_expiration_notice_sent_at", precision: nil t.datetime "en_instruction_at", precision: nil t.boolean "for_procedure_preview", default: false, null: false + t.boolean "for_tiers", 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: nil @@ -429,6 +430,8 @@ t.datetime "last_champ_private_updated_at", precision: nil t.datetime "last_champ_updated_at", precision: nil t.datetime "last_commentaire_updated_at", precision: nil + t.string "mandataire_first_name" + t.string "mandataire_last_name" t.text "motivation" t.bigint "parent_dossier_id" t.string "prefill_token" @@ -437,13 +440,15 @@ t.datetime "processed_at", precision: nil t.datetime "re_instructed_at" t.bigint "revision_id" - t.string "search_terms" + t.text "search_terms" t.string "state" t.date "sva_svr_decision_on" t.datetime "sva_svr_decision_triggered_at" t.datetime "termine_close_to_expiration_notice_sent_at", precision: nil t.datetime "updated_at", precision: nil t.integer "user_id" + t.index "to_tsvector('french'::regconfig, (search_terms || private_search_terms))", name: "index_dossiers_on_search_terms_private_search_terms", using: :gin + t.index "to_tsvector('french'::regconfig, search_terms)", name: "index_dossiers_on_search_terms", using: :gin t.index ["archived"], name: "index_dossiers_on_archived" t.index ["batch_operation_id"], name: "index_dossiers_on_batch_operation_id" t.index ["dossier_transfer_id"], name: "index_dossiers_on_dossier_transfer_id" @@ -672,11 +677,14 @@ t.date "birthdate" t.datetime "created_at", precision: nil t.integer "dossier_id" + t.string "email" t.string "gender" t.string "nom" + t.string "notification_method" t.string "prenom" t.datetime "updated_at", precision: nil t.index ["dossier_id"], name: "index_individuals_on_dossier_id", unique: true + t.index ["email"], name: "index_individuals_on_email" end create_table "initiated_mails", id: :serial, force: :cascade do |t| @@ -1029,12 +1037,18 @@ t.text "description" t.string "libelle" t.boolean "mandatory", default: false + t.boolean "migrated_parent" t.jsonb "options" + t.integer "order_place" + t.bigint "parent_id" t.boolean "private", default: false, null: false + t.bigint "revision_id" t.bigint "stable_id" t.string "type_champ" t.datetime "updated_at", precision: nil + t.index ["parent_id"], name: "index_types_de_champ_on_parent_id" t.index ["private"], name: "index_types_de_champ_on_private" + t.index ["revision_id"], name: "index_types_de_champ_on_revision_id" t.index ["stable_id"], name: "index_types_de_champ_on_stable_id" end @@ -1132,9 +1146,6 @@ add_foreign_key "bulk_messages_groupe_instructeurs", "bulk_messages" add_foreign_key "bulk_messages_groupe_instructeurs", "groupe_instructeurs" add_foreign_key "champs", "champs", column: "parent_id" - add_foreign_key "champs", "dossiers" - add_foreign_key "champs", "etablissements" - add_foreign_key "champs", "types_de_champ" add_foreign_key "closed_mails", "procedures" add_foreign_key "commentaires", "dossiers" add_foreign_key "commentaires", "experts" @@ -1153,7 +1164,6 @@ add_foreign_key "dossiers", "groupe_instructeurs" add_foreign_key "dossiers", "procedure_revisions", column: "revision_id" add_foreign_key "dossiers", "users" - add_foreign_key "etablissements", "dossiers" add_foreign_key "experts", "users" add_foreign_key "experts_procedures", "experts" add_foreign_key "experts_procedures", "procedures" @@ -1182,6 +1192,8 @@ add_foreign_key "targeted_user_links", "users" add_foreign_key "traitements", "dossiers" add_foreign_key "trusted_device_tokens", "instructeurs" + add_foreign_key "types_de_champ", "procedure_revisions", column: "revision_id" + add_foreign_key "types_de_champ", "types_de_champ", column: "parent_id" add_foreign_key "users", "users", column: "requested_merge_into_id" add_foreign_key "without_continuation_mails", "procedures" add_foreign_key "zone_labels", "zones"