From dfafc57bb98a757efaa22fdd9fec51a86042f7bb Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 7 Sep 2021 10:26:30 +0200 Subject: [PATCH] feat(dossier): add dossier_transfers and dossier_transfer_logs --- ...20210721140812_create_dossier_transfers.rb | 11 ++++++++++ ...0721162213_create_dossier_transfer_logs.rb | 11 ++++++++++ db/schema.rb | 22 ++++++++++++++++++- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20210721140812_create_dossier_transfers.rb create mode 100644 db/migrate/20210721162213_create_dossier_transfer_logs.rb diff --git a/db/migrate/20210721140812_create_dossier_transfers.rb b/db/migrate/20210721140812_create_dossier_transfers.rb new file mode 100644 index 000000000..f247319f2 --- /dev/null +++ b/db/migrate/20210721140812_create_dossier_transfers.rb @@ -0,0 +1,11 @@ +class CreateDossierTransfers < ActiveRecord::Migration[6.1] + def change + create_table :dossier_transfers do |t| + t.string :email, null: false, index: true + + t.timestamps + end + + add_reference :dossiers, :dossier_transfer, foreign_key: true, null: true, index: true + end +end diff --git a/db/migrate/20210721162213_create_dossier_transfer_logs.rb b/db/migrate/20210721162213_create_dossier_transfer_logs.rb new file mode 100644 index 000000000..5353ddc5b --- /dev/null +++ b/db/migrate/20210721162213_create_dossier_transfer_logs.rb @@ -0,0 +1,11 @@ +class CreateDossierTransferLogs < ActiveRecord::Migration[6.1] + def change + create_table :dossier_transfer_logs do |t| + t.string :from, null: false + t.string :to, null: false + t.references :dossier, foreign_key: true, null: false, index: true + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 8cc67d824..6a5f1c695 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.define(version: 2021_08_26_161956) do +ActiveRecord::Schema.define(version: 2021_08_27_161956) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -268,6 +268,22 @@ ActiveRecord::Schema.define(version: 2021_08_26_161956) do t.index ["keep_until"], name: "index_dossier_operation_logs_on_keep_until" end + create_table "dossier_transfer_logs", force: :cascade do |t| + t.string "from", null: false + t.string "to", null: false + t.bigint "dossier_id", null: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["dossier_id"], name: "index_dossier_transfer_logs_on_dossier_id" + end + + create_table "dossier_transfers", force: :cascade do |t| + t.string "email", null: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["email"], name: "index_dossier_transfers_on_email" + end + create_table "dossiers", id: :serial, force: :cascade do |t| t.boolean "autorisation_donnees" t.datetime "created_at" @@ -299,7 +315,9 @@ ActiveRecord::Schema.define(version: 2021_08_26_161956) do t.datetime "declarative_triggered_at" 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.bigint "dossier_transfer_id" t.index ["archived"], name: "index_dossiers_on_archived" + t.index ["dossier_transfer_id"], name: "index_dossiers_on_dossier_transfer_id" t.index ["groupe_instructeur_id"], name: "index_dossiers_on_groupe_instructeur_id" t.index ["hidden_at"], name: "index_dossiers_on_hidden_at" t.index ["revision_id"], name: "index_dossiers_on_revision_id" @@ -797,6 +815,8 @@ ActiveRecord::Schema.define(version: 2021_08_26_161956) do add_foreign_key "commentaires", "experts" add_foreign_key "dossier_operation_logs", "bill_signatures" add_foreign_key "dossier_operation_logs", "instructeurs" + add_foreign_key "dossier_transfer_logs", "dossiers" + add_foreign_key "dossiers", "dossier_transfers" add_foreign_key "dossiers", "groupe_instructeurs" add_foreign_key "dossiers", "procedure_revisions", column: "revision_id" add_foreign_key "dossiers", "users"