use traitement model

when a dossier is terminated (accepte, refuse or classe_sans_suite),
we store now `processed_at` and `motivation` in a traitement instance
This commit is contained in:
Christophe Robillard 2020-07-02 11:02:50 +02:00
parent f631acd118
commit a072d35211
14 changed files with 107 additions and 29 deletions

View file

@ -0,0 +1,11 @@
class CreateTraitements < ActiveRecord::Migration[5.2]
def change
create_table :traitements do |t|
t.references :dossier, foreign_key: true
t.references :instructeur, foreign_key: true
t.string :motivation
t.string :state
t.timestamp :processed_at
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: 2020_06_11_122406) do
ActiveRecord::Schema.define(version: 2020_06_30_140356) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -560,6 +560,16 @@ ActiveRecord::Schema.define(version: 2020_06_11_122406) do
t.string "version", null: false
end
create_table "traitements", force: :cascade do |t|
t.bigint "dossier_id"
t.bigint "instructeur_id"
t.string "motivation"
t.string "state"
t.datetime "processed_at"
t.index ["dossier_id"], name: "index_traitements_on_dossier_id"
t.index ["instructeur_id"], name: "index_traitements_on_instructeur_id"
end
create_table "trusted_device_tokens", force: :cascade do |t|
t.string "token", null: false
t.bigint "instructeur_id"
@ -660,6 +670,8 @@ ActiveRecord::Schema.define(version: 2020_06_11_122406) do
add_foreign_key "received_mails", "procedures"
add_foreign_key "refused_mails", "procedures"
add_foreign_key "services", "administrateurs"
add_foreign_key "traitements", "dossiers"
add_foreign_key "traitements", "instructeurs"
add_foreign_key "trusted_device_tokens", "instructeurs"
add_foreign_key "types_de_champ", "types_de_champ", column: "parent_id"
add_foreign_key "users", "administrateurs"