Add DossierOperationLog model
This commit is contained in:
parent
98d388b64d
commit
85e3eb04f4
4 changed files with 38 additions and 1 deletions
|
@ -28,6 +28,8 @@ class Dossier < ApplicationRecord
|
|||
has_many :followers_gestionnaires, through: :follows, source: :gestionnaire
|
||||
has_many :avis, dependent: :destroy
|
||||
|
||||
has_many :dossier_operation_logs
|
||||
|
||||
belongs_to :procedure
|
||||
belongs_to :user
|
||||
|
||||
|
|
12
app/models/dossier_operation_log.rb
Normal file
12
app/models/dossier_operation_log.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
class DossierOperationLog < ApplicationRecord
|
||||
enum operation: {
|
||||
passer_en_instruction: 'passer_en_instruction',
|
||||
repasser_en_construction: 'repasser_en_construction',
|
||||
accepter: 'accepter',
|
||||
refuser: 'refuser',
|
||||
classer_sans_suite: 'classer_sans_suite'
|
||||
}
|
||||
|
||||
belongs_to :dossier
|
||||
belongs_to :gestionnaire
|
||||
end
|
11
db/migrate/20181123195208_create_dossier_operation_logs.rb
Normal file
11
db/migrate/20181123195208_create_dossier_operation_logs.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class CreateDossierOperationLogs < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :dossier_operation_logs do |t|
|
||||
t.string :operation, null: false
|
||||
t.references :dossier, foreign_key: true, index: true
|
||||
t.references :gestionnaire, foreign_key: true, index: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
14
db/schema.rb
14
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: 2018_11_21_234008) do
|
||||
ActiveRecord::Schema.define(version: 2018_11_23_195208) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -218,6 +218,16 @@ ActiveRecord::Schema.define(version: 2018_11_21_234008) do
|
|||
t.index ["procedure_id"], name: "index_deleted_dossiers_on_procedure_id"
|
||||
end
|
||||
|
||||
create_table "dossier_operation_logs", force: :cascade do |t|
|
||||
t.string "operation", null: false
|
||||
t.bigint "dossier_id"
|
||||
t.bigint "gestionnaire_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["dossier_id"], name: "index_dossier_operation_logs_on_dossier_id"
|
||||
t.index ["gestionnaire_id"], name: "index_dossier_operation_logs_on_gestionnaire_id"
|
||||
end
|
||||
|
||||
create_table "dossiers", id: :serial, force: :cascade do |t|
|
||||
t.boolean "autorisation_donnees"
|
||||
t.integer "procedure_id"
|
||||
|
@ -608,6 +618,8 @@ ActiveRecord::Schema.define(version: 2018_11_21_234008) do
|
|||
add_foreign_key "avis", "gestionnaires", column: "claimant_id"
|
||||
add_foreign_key "closed_mails", "procedures"
|
||||
add_foreign_key "commentaires", "dossiers"
|
||||
add_foreign_key "dossier_operation_logs", "dossiers"
|
||||
add_foreign_key "dossier_operation_logs", "gestionnaires"
|
||||
add_foreign_key "dossiers", "users"
|
||||
add_foreign_key "feedbacks", "users"
|
||||
add_foreign_key "geo_areas", "champs"
|
||||
|
|
Loading…
Reference in a new issue