chore(schema): add contact_forms

This commit is contained in:
Colin Darie 2024-07-30 18:26:53 +02:00
parent ff62e99e7b
commit 4bc0a04106
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
4 changed files with 50 additions and 1 deletions

View file

@ -0,0 +1,2 @@
class ContactForm < ApplicationRecord
end

View 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

View file

@ -10,7 +10,7 @@
#
# 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
enable_extension "pg_buffercache"
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"
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|
t.text "adresse", 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", "experts"
add_foreign_key "commentaires", "instructeurs"
add_foreign_key "contact_forms", "users"
add_foreign_key "contact_informations", "groupe_instructeurs"
add_foreign_key "dossier_assignments", "dossiers"
add_foreign_key "dossier_batch_operations", "batch_operations"

View 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