create Bulk Message model and migration
This commit is contained in:
parent
9c976c6b71
commit
ab0782530c
3 changed files with 55 additions and 0 deletions
18
app/models/bulk_message.rb
Normal file
18
app/models/bulk_message.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: bulk_messages
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# body :text not null
|
||||
# dossier_count :integer
|
||||
# dossier_state :string
|
||||
# sent_at :datetime not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# instructeur_id :bigint not null
|
||||
#
|
||||
class BulkMessage < ApplicationRecord
|
||||
belongs_to :instructeur
|
||||
has_one_attached :piece_jointe
|
||||
has_and_belongs_to_many :groupe_instructeurs
|
||||
end
|
18
db/migrate/20210722083911_create_bulk_message_mails.rb
Normal file
18
db/migrate/20210722083911_create_bulk_message_mails.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
class CreateBulkMessageMails < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :bulk_messages do |t|
|
||||
t.text :body, null: false
|
||||
t.integer :dossier_count
|
||||
t.string :dossier_state
|
||||
t.datetime :sent_at, null: false
|
||||
t.bigint :instructeur_id, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_join_table :bulk_messages, :groupe_instructeurs, column_options: { null: true, foreign_key: true } do |t|
|
||||
t.index :bulk_message_id
|
||||
t.index :groupe_instructeur_id, name: :index_bulk_messages_groupe_instructeurs_on_gi_id
|
||||
end
|
||||
end
|
||||
end
|
19
db/schema.rb
19
db/schema.rb
|
@ -156,6 +156,23 @@ ActiveRecord::Schema.define(version: 2021_07_22_133553) do
|
|||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "bulk_messages", force: :cascade do |t|
|
||||
t.text "body", null: false
|
||||
t.integer "dossier_count"
|
||||
t.string "dossier_state"
|
||||
t.datetime "sent_at", null: false
|
||||
t.bigint "instructeur_id", null: false
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
end
|
||||
|
||||
create_table "bulk_messages_groupe_instructeurs", id: false, force: :cascade do |t|
|
||||
t.bigint "bulk_message_id"
|
||||
t.bigint "groupe_instructeur_id"
|
||||
t.index ["bulk_message_id"], name: "index_bulk_messages_groupe_instructeurs_on_bulk_message_id"
|
||||
t.index ["groupe_instructeur_id"], name: "index_bulk_messages_groupe_instructeurs_on_gi_id"
|
||||
end
|
||||
|
||||
create_table "champs", id: :serial, force: :cascade do |t|
|
||||
t.string "value"
|
||||
t.integer "type_de_champ_id"
|
||||
|
@ -767,6 +784,8 @@ ActiveRecord::Schema.define(version: 2021_07_22_133553) do
|
|||
add_foreign_key "attestation_templates", "procedures"
|
||||
add_foreign_key "attestations", "dossiers"
|
||||
add_foreign_key "avis", "experts_procedures"
|
||||
add_foreign_key "bulk_messages_groupe_instructeurs", "bulk_messages"
|
||||
add_foreign_key "bulk_messages_groupe_instructeurs", "groupe_instructeurs"
|
||||
add_foreign_key "champs", "champs", column: "parent_id"
|
||||
add_foreign_key "closed_mails", "procedures"
|
||||
add_foreign_key "commentaires", "dossiers"
|
||||
|
|
Loading…
Reference in a new issue