Added user model and fixed reference in migration
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
class CreateJobs < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :jobs do |t|
|
||||
t.references :operator_id, null: false, foreign_key: true
|
||||
t.references :costumer_id, null: false, foreign_key: true
|
||||
t.references :operator, null: true
|
||||
t.references :costumer, null: true
|
||||
t.string :operator_firstname
|
||||
t.string :operator_lastname
|
||||
t.string :costumer_firstname
|
||||
|
||||
13
db/migrate/20240730214152_create_users.rb
Normal file
13
db/migrate/20240730214152_create_users.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class CreateUsers < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :users do |t|
|
||||
t.string :firstname
|
||||
t.string :lastname
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_foreign_key :jobs, :users, column: :operator_id
|
||||
add_foreign_key :jobs, :users, column: :costumer_id
|
||||
end
|
||||
end
|
||||
21
db/schema.rb
generated
21
db/schema.rb
generated
@@ -10,10 +10,10 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_07_27_101347) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_07_30_214152) do
|
||||
create_table "jobs", force: :cascade do |t|
|
||||
t.integer "operator_id_id", null: false
|
||||
t.integer "costumer_id_id", null: false
|
||||
t.integer "operator_id"
|
||||
t.integer "costumer_id"
|
||||
t.string "operator_firstname"
|
||||
t.string "operator_lastname"
|
||||
t.string "costumer_firstname"
|
||||
@@ -29,10 +29,17 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_27_101347) do
|
||||
t.float "costum_qm_plan"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["costumer_id_id"], name: "index_jobs_on_costumer_id_id"
|
||||
t.index ["operator_id_id"], name: "index_jobs_on_operator_id_id"
|
||||
t.index ["costumer_id"], name: "index_jobs_on_costumer_id"
|
||||
t.index ["operator_id"], name: "index_jobs_on_operator_id"
|
||||
end
|
||||
|
||||
add_foreign_key "jobs", "costumer_ids"
|
||||
add_foreign_key "jobs", "operator_ids"
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "firstname"
|
||||
t.string "lastname"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_foreign_key "jobs", "users", column: "costumer_id"
|
||||
add_foreign_key "jobs", "users", column: "operator_id"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user