chore(schema): add contact_forms
This commit is contained in:
parent
ff62e99e7b
commit
4bc0a04106
4 changed files with 50 additions and 1 deletions
2
app/models/contact_form.rb
Normal file
2
app/models/contact_form.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
class ContactForm < ApplicationRecord
|
||||||
|
end
|
17
db/migrate/20240729160650_create_contact_forms.rb
Normal file
17
db/migrate/20240729160650_create_contact_forms.rb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
class CreateContactForms < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
create_table :contact_forms do |t|
|
||||||
|
t.string :email
|
||||||
|
t.string :subject, null: false
|
||||||
|
t.text :text, null: false
|
||||||
|
t.string :question_type, null: false
|
||||||
|
t.references :user, null: true, foreign_key: true
|
||||||
|
t.bigint :dossier_id # not a reference (dossier may not exist)
|
||||||
|
t.string :phone
|
||||||
|
t.string :tags, array: true, default: []
|
||||||
|
t.boolean :for_admin, default: false, null: false
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
18
db/schema.rb
18
db/schema.rb
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2024_07_16_091043) do
|
ActiveRecord::Schema[7.0].define(version: 2024_07_29_160650) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_buffercache"
|
enable_extension "pg_buffercache"
|
||||||
enable_extension "pg_stat_statements"
|
enable_extension "pg_stat_statements"
|
||||||
|
@ -315,6 +315,21 @@ ActiveRecord::Schema[7.0].define(version: 2024_07_16_091043) do
|
||||||
t.index ["instructeur_id"], name: "index_commentaires_on_instructeur_id"
|
t.index ["instructeur_id"], name: "index_commentaires_on_instructeur_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "contact_forms", force: :cascade do |t|
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.bigint "dossier_id"
|
||||||
|
t.string "email"
|
||||||
|
t.boolean "for_admin", default: false, null: false
|
||||||
|
t.string "phone"
|
||||||
|
t.string "question_type", null: false
|
||||||
|
t.string "subject", null: false
|
||||||
|
t.string "tags", default: [], array: true
|
||||||
|
t.text "text", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.bigint "user_id"
|
||||||
|
t.index ["user_id"], name: "index_contact_forms_on_user_id"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "contact_informations", force: :cascade do |t|
|
create_table "contact_informations", force: :cascade do |t|
|
||||||
t.text "adresse", null: false
|
t.text "adresse", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
|
@ -1229,6 +1244,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_07_16_091043) do
|
||||||
add_foreign_key "commentaires", "dossiers"
|
add_foreign_key "commentaires", "dossiers"
|
||||||
add_foreign_key "commentaires", "experts"
|
add_foreign_key "commentaires", "experts"
|
||||||
add_foreign_key "commentaires", "instructeurs"
|
add_foreign_key "commentaires", "instructeurs"
|
||||||
|
add_foreign_key "contact_forms", "users"
|
||||||
add_foreign_key "contact_informations", "groupe_instructeurs"
|
add_foreign_key "contact_informations", "groupe_instructeurs"
|
||||||
add_foreign_key "dossier_assignments", "dossiers"
|
add_foreign_key "dossier_assignments", "dossiers"
|
||||||
add_foreign_key "dossier_batch_operations", "batch_operations"
|
add_foreign_key "dossier_batch_operations", "batch_operations"
|
||||||
|
|
14
spec/factories/contact_form.rb
Normal file
14
spec/factories/contact_form.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :contact_form do
|
||||||
|
user { nil }
|
||||||
|
email { 'test@example.com' }
|
||||||
|
dossier_id { nil }
|
||||||
|
subject { 'Test Subject' }
|
||||||
|
text { 'Test Content' }
|
||||||
|
question_type { 'lost_user' }
|
||||||
|
tags { ['test tag'] }
|
||||||
|
phone { nil }
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue