Create new model to store deleted dossier metadatas

This commit is contained in:
Mathieu Magnin 2018-05-30 11:36:48 +02:00
parent b68563f45f
commit 55a3d59e38
4 changed files with 27 additions and 1 deletions

View file

@ -0,0 +1,3 @@
class DeletedDossier < ApplicationRecord
belongs_to :procedure
end

View file

@ -3,6 +3,7 @@ class Procedure < ApplicationRecord
has_many :types_de_champ, -> { public_only }, dependent: :destroy
has_many :types_de_champ_private, -> { private_only }, class_name: 'TypeDeChamp', dependent: :destroy
has_many :dossiers
has_many :deleted_dossiers, dependent: :destroy
has_one :module_api_carto, dependent: :destroy
has_one :attestation_template, dependent: :destroy

View file

@ -0,0 +1,12 @@
class CreateDeletedDossiers < ActiveRecord::Migration[5.2]
def change
create_table :deleted_dossiers do |t|
t.references :procedure
t.bigint :dossier_id
t.datetime :deleted_at
t.string :state
t.timestamps
end
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_05_22_142109) do
ActiveRecord::Schema.define(version: 2018_05_30_095508) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -220,6 +220,16 @@ ActiveRecord::Schema.define(version: 2018_05_22_142109) do
t.index ["priority", "run_at"], name: "delayed_jobs_priority"
end
create_table "deleted_dossiers", force: :cascade do |t|
t.bigint "procedure_id"
t.bigint "dossier_id"
t.datetime "deleted_at"
t.string "state"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["procedure_id"], name: "index_deleted_dossiers_on_procedure_id"
end
create_table "dossiers", id: :serial, force: :cascade do |t|
t.boolean "autorisation_donnees"
t.integer "procedure_id"