create procedure_labels

This commit is contained in:
Lisa Durand 2024-09-25 15:05:09 +02:00
parent 83c942c338
commit 9dd224c3c7
No known key found for this signature in database
GPG key ID: 0DF91F2CA1E8B816
4 changed files with 30 additions and 0 deletions

View file

@ -60,6 +60,7 @@ class Procedure < ApplicationRecord
has_and_belongs_to_many :procedure_tags has_and_belongs_to_many :procedure_tags
has_many :bulk_messages, dependent: :destroy has_many :bulk_messages, dependent: :destroy
has_many :procedure_labels, dependent: :destroy
def active_dossier_submitted_message def active_dossier_submitted_message
published_dossier_submitted_message || draft_dossier_submitted_message published_dossier_submitted_message || draft_dossier_submitted_message

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
class ProcedureLabel < ApplicationRecord
belongs_to :procedure
validates :name, :color, presence: true
end

View 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

View file

@ -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 t.index ["from"], name: "index_path_rewrites_on_from", unique: true
end 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| create_table "procedure_presentations", id: :serial, force: :cascade do |t|
t.jsonb "a_suivre_filters", default: [], null: false, array: true t.jsonb "a_suivre_filters", default: [], null: false, array: true
t.jsonb "archives_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 "initiated_mails", "procedures"
add_foreign_key "instructeurs", "users" add_foreign_key "instructeurs", "users"
add_foreign_key "merge_logs", "users" add_foreign_key "merge_logs", "users"
add_foreign_key "procedure_labels", "procedures"
add_foreign_key "procedure_presentations", "assign_tos" 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_revision_types_de_champ", column: "parent_id"
add_foreign_key "procedure_revision_types_de_champ", "procedure_revisions", column: "revision_id" add_foreign_key "procedure_revision_types_de_champ", "procedure_revisions", column: "revision_id"