Service: create model
This commit is contained in:
parent
c62cddc389
commit
fc17b68dc1
9 changed files with 107 additions and 0 deletions
10
db/migrate/20180416120759_create_services.rb
Normal file
10
db/migrate/20180416120759_create_services.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreateServices < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :services do |t|
|
||||
t.string :type_organisme, null: false
|
||||
t.string :nom, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
5
db/migrate/20180416122152_add_service_to_procedures.rb
Normal file
5
db/migrate/20180416122152_add_service_to_procedures.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddServiceToProcedures < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_reference :procedures, :service, foreign_key: true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddAdministrateurToServices < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_reference :services, :administrateur, foreign_key: true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddUniqueIndexToServices < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_index :services, [:administrateur_id, :nom], unique: true
|
||||
end
|
||||
end
|
14
db/schema.rb
14
db/schema.rb
|
@ -466,8 +466,10 @@ ActiveRecord::Schema.define(version: 2018_05_15_135415) do
|
|||
t.bigint "parent_procedure_id"
|
||||
t.datetime "test_started_at"
|
||||
t.string "aasm_state", default: "brouillon"
|
||||
t.bigint "service_id"
|
||||
t.index ["hidden_at"], name: "index_procedures_on_hidden_at"
|
||||
t.index ["parent_procedure_id"], name: "index_procedures_on_parent_procedure_id"
|
||||
t.index ["service_id"], name: "index_procedures_on_service_id"
|
||||
end
|
||||
|
||||
create_table "quartier_prioritaires", id: :serial, force: :cascade do |t|
|
||||
|
@ -511,6 +513,16 @@ ActiveRecord::Schema.define(version: 2018_05_15_135415) do
|
|||
t.index ["entreprise_id"], name: "index_rna_informations_on_entreprise_id"
|
||||
end
|
||||
|
||||
create_table "services", force: :cascade do |t|
|
||||
t.string "type_organisme", null: false
|
||||
t.string "nom", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.bigint "administrateur_id"
|
||||
t.index ["administrateur_id", "nom"], name: "index_services_on_administrateur_id_and_nom", unique: true
|
||||
t.index ["administrateur_id"], name: "index_services_on_administrateur_id"
|
||||
end
|
||||
|
||||
create_table "types_de_champ", id: :serial, force: :cascade do |t|
|
||||
t.string "libelle"
|
||||
t.string "type_champ"
|
||||
|
@ -576,8 +588,10 @@ ActiveRecord::Schema.define(version: 2018_05_15_135415) do
|
|||
add_foreign_key "procedure_paths", "administrateurs"
|
||||
add_foreign_key "procedure_paths", "procedures"
|
||||
add_foreign_key "procedure_presentations", "assign_tos"
|
||||
add_foreign_key "procedures", "services"
|
||||
add_foreign_key "received_mails", "procedures"
|
||||
add_foreign_key "refused_mails", "procedures"
|
||||
add_foreign_key "services", "administrateurs"
|
||||
add_foreign_key "without_continuation_mails", "procedures"
|
||||
|
||||
create_view "searches", sql_definition: <<-SQL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue