create procedure_labels
This commit is contained in:
parent
83c942c338
commit
9dd224c3c7
4 changed files with 30 additions and 0 deletions
|
@ -60,6 +60,7 @@ class Procedure < ApplicationRecord
|
|||
has_and_belongs_to_many :procedure_tags
|
||||
|
||||
has_many :bulk_messages, dependent: :destroy
|
||||
has_many :procedure_labels, dependent: :destroy
|
||||
|
||||
def active_dossier_submitted_message
|
||||
published_dossier_submitted_message || draft_dossier_submitted_message
|
||||
|
|
7
app/models/procedure_label.rb
Normal file
7
app/models/procedure_label.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ProcedureLabel < ApplicationRecord
|
||||
belongs_to :procedure
|
||||
|
||||
validates :name, :color, presence: true
|
||||
end
|
12
db/migrate/20240924151336_create_procedure_labels.rb
Normal file
12
db/migrate/20240924151336_create_procedure_labels.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateProcedureLabels < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :procedure_labels do |t|
|
||||
t.string :name
|
||||
t.string :color
|
||||
t.references :procedure, null: false, foreign_key: true
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
10
db/schema.rb
10
db/schema.rb
|
@ -869,6 +869,15 @@ ActiveRecord::Schema[7.0].define(version: 2024_10_14_084333) do
|
|||
t.index ["from"], name: "index_path_rewrites_on_from", unique: true
|
||||
end
|
||||
|
||||
create_table "procedure_labels", force: :cascade do |t|
|
||||
t.string "color"
|
||||
t.datetime "created_at", null: false
|
||||
t.string "name"
|
||||
t.bigint "procedure_id", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["procedure_id"], name: "index_procedure_labels_on_procedure_id"
|
||||
end
|
||||
|
||||
create_table "procedure_presentations", id: :serial, force: :cascade do |t|
|
||||
t.jsonb "a_suivre_filters", default: [], null: false, array: true
|
||||
t.jsonb "archives_filters", default: [], null: false, array: true
|
||||
|
@ -1301,6 +1310,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_10_14_084333) do
|
|||
add_foreign_key "initiated_mails", "procedures"
|
||||
add_foreign_key "instructeurs", "users"
|
||||
add_foreign_key "merge_logs", "users"
|
||||
add_foreign_key "procedure_labels", "procedures"
|
||||
add_foreign_key "procedure_presentations", "assign_tos"
|
||||
add_foreign_key "procedure_revision_types_de_champ", "procedure_revision_types_de_champ", column: "parent_id"
|
||||
add_foreign_key "procedure_revision_types_de_champ", "procedure_revisions", column: "revision_id"
|
||||
|
|
Loading…
Reference in a new issue