Rezervacije
This commit is contained in:
13
db/migrate/20240804052139_create_customers.rb
Normal file
13
db/migrate/20240804052139_create_customers.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class CreateCustomers < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :customers do |t|
|
||||
t.string :name
|
||||
t.string :phone
|
||||
t.text :notes
|
||||
t.string :email
|
||||
t.integer :birthyear
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
5
db/migrate/20240804053208_add_company_id_to_customers.rb
Normal file
5
db/migrate/20240804053208_add_company_id_to_customers.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddCompanyIdToCustomers < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
add_column :customers, :company_id, :integer
|
||||
end
|
||||
end
|
||||
10
db/migrate/20240804060103_create_places.rb
Normal file
10
db/migrate/20240804060103_create_places.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class CreatePlaces < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :places do |t|
|
||||
t.string :name
|
||||
t.references :company, null: false, foreign_key: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
15
db/migrate/20240804060112_create_reservations.rb
Normal file
15
db/migrate/20240804060112_create_reservations.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class CreateReservations < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :reservations do |t|
|
||||
t.references :company, null: false, foreign_key: true
|
||||
t.references :customer, null: false, foreign_key: true
|
||||
t.references :place, null: false, foreign_key: true
|
||||
t.string :title
|
||||
t.text :description
|
||||
t.datetime :start_time
|
||||
t.datetime :end_time
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
40
db/schema.rb
generated
40
db/schema.rb
generated
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_05_18_200749) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_08_04_060112) do
|
||||
create_table "companies", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "id_number"
|
||||
@@ -25,4 +25,42 @@ ActiveRecord::Schema[7.1].define(version: 2024_05_18_200749) do
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "customers", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "phone"
|
||||
t.text "notes"
|
||||
t.string "email"
|
||||
t.integer "birthyear"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "company_id"
|
||||
end
|
||||
|
||||
create_table "places", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.integer "company_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["company_id"], name: "index_places_on_company_id"
|
||||
end
|
||||
|
||||
create_table "reservations", force: :cascade do |t|
|
||||
t.integer "company_id", null: false
|
||||
t.integer "customer_id", null: false
|
||||
t.integer "place_id", null: false
|
||||
t.string "title"
|
||||
t.text "description"
|
||||
t.datetime "start_time"
|
||||
t.datetime "end_time"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["company_id"], name: "index_reservations_on_company_id"
|
||||
t.index ["customer_id"], name: "index_reservations_on_customer_id"
|
||||
t.index ["place_id"], name: "index_reservations_on_place_id"
|
||||
end
|
||||
|
||||
add_foreign_key "places", "companies"
|
||||
add_foreign_key "reservations", "companies"
|
||||
add_foreign_key "reservations", "customers"
|
||||
add_foreign_key "reservations", "places"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user