Create new model to store deleted dossier metadatas
This commit is contained in:
parent
b68563f45f
commit
55a3d59e38
4 changed files with 27 additions and 1 deletions
3
app/models/deleted_dossier.rb
Normal file
3
app/models/deleted_dossier.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class DeletedDossier < ApplicationRecord
|
||||||
|
belongs_to :procedure
|
||||||
|
end
|
|
@ -3,6 +3,7 @@ class Procedure < ApplicationRecord
|
||||||
has_many :types_de_champ, -> { public_only }, dependent: :destroy
|
has_many :types_de_champ, -> { public_only }, dependent: :destroy
|
||||||
has_many :types_de_champ_private, -> { private_only }, class_name: 'TypeDeChamp', dependent: :destroy
|
has_many :types_de_champ_private, -> { private_only }, class_name: 'TypeDeChamp', dependent: :destroy
|
||||||
has_many :dossiers
|
has_many :dossiers
|
||||||
|
has_many :deleted_dossiers, dependent: :destroy
|
||||||
|
|
||||||
has_one :module_api_carto, dependent: :destroy
|
has_one :module_api_carto, dependent: :destroy
|
||||||
has_one :attestation_template, dependent: :destroy
|
has_one :attestation_template, dependent: :destroy
|
||||||
|
|
12
db/migrate/20180530095508_create_deleted_dossiers.rb
Normal file
12
db/migrate/20180530095508_create_deleted_dossiers.rb
Normal 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
|
12
db/schema.rb
12
db/schema.rb
|
@ -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: 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
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
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"
|
t.index ["priority", "run_at"], name: "delayed_jobs_priority"
|
||||||
end
|
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|
|
create_table "dossiers", id: :serial, force: :cascade do |t|
|
||||||
t.boolean "autorisation_donnees"
|
t.boolean "autorisation_donnees"
|
||||||
t.integer "procedure_id"
|
t.integer "procedure_id"
|
||||||
|
|
Loading…
Reference in a new issue