Ajout du model expert
Co-authored-by: Kara Diaby <kdiaby.pro@gmail.com>
This commit is contained in:
parent
f698dc798c
commit
29e9f2dd32
5 changed files with 35 additions and 1 deletions
11
app/models/expert.rb
Normal file
11
app/models/expert.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: experts
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
class Expert < ApplicationRecord
|
||||
has_one :user
|
||||
end
|
|
@ -25,6 +25,7 @@
|
|||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# administrateur_id :bigint
|
||||
# expert_id :bigint
|
||||
# instructeur_id :bigint
|
||||
#
|
||||
class User < ApplicationRecord
|
||||
|
@ -48,6 +49,7 @@ class User < ApplicationRecord
|
|||
has_one :france_connect_information, dependent: :destroy
|
||||
belongs_to :instructeur, optional: true
|
||||
belongs_to :administrateur, optional: true
|
||||
belongs_to :expert, optional: true
|
||||
|
||||
accepts_nested_attributes_for :france_connect_information
|
||||
|
||||
|
|
7
db/migrate/20210107143316_create_experts.rb
Normal file
7
db/migrate/20210107143316_create_experts.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class CreateExperts < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :experts do |t| # rubocop:disable Style/SymbolProc
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
6
db/migrate/20210107143938_link_user_and_expert.rb
Normal file
6
db/migrate/20210107143938_link_user_and_expert.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class LinkUserAndExpert < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_reference :users, :expert, index: true
|
||||
add_foreign_key :users, :experts
|
||||
end
|
||||
end
|
10
db/schema.rb
10
db/schema.rb
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_01_14_224721) do
|
||||
ActiveRecord::Schema.define(version: 2021_01_07_143938) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -321,6 +321,11 @@ ActiveRecord::Schema.define(version: 2021_01_14_224721) do
|
|||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "experts", force: :cascade do |t|
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
end
|
||||
|
||||
create_table "exports", force: :cascade do |t|
|
||||
t.string "format", null: false
|
||||
t.datetime "created_at", null: false
|
||||
|
@ -676,9 +681,11 @@ ActiveRecord::Schema.define(version: 2021_01_14_224721) do
|
|||
t.datetime "locked_at"
|
||||
t.bigint "instructeur_id"
|
||||
t.bigint "administrateur_id"
|
||||
t.bigint "expert_id"
|
||||
t.index ["administrateur_id"], name: "index_users_on_administrateur_id"
|
||||
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
||||
t.index ["email"], name: "index_users_on_email", unique: true
|
||||
t.index ["expert_id"], name: "index_users_on_expert_id"
|
||||
t.index ["instructeur_id"], name: "index_users_on_instructeur_id"
|
||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
||||
|
@ -734,6 +741,7 @@ ActiveRecord::Schema.define(version: 2021_01_14_224721) do
|
|||
add_foreign_key "types_de_champ", "procedure_revisions", column: "revision_id"
|
||||
add_foreign_key "types_de_champ", "types_de_champ", column: "parent_id"
|
||||
add_foreign_key "users", "administrateurs"
|
||||
add_foreign_key "users", "experts"
|
||||
add_foreign_key "users", "instructeurs"
|
||||
add_foreign_key "without_continuation_mails", "procedures"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue