diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-15 12:22:11 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-03-15 12:22:11 -0600 |
| commit | bf125e55535a1002e3e2c66b201727303df3c0b7 (patch) | |
| tree | 56c382fa8cc94f255dd52014af6b264d4e008815 | |
| parent | 87ef7d3c9cab6958c7d2c480edfe619bcab36e80 (diff) | |
Create beds
| -rw-r--r-- | rvh/app/models/bed.rb | 4 | ||||
| -rw-r--r-- | rvh/db/migrate/20200315182108_create_beds.rb | 11 | ||||
| -rw-r--r-- | rvh/db/schema.rb | 14 |
3 files changed, 28 insertions, 1 deletions
diff --git a/rvh/app/models/bed.rb b/rvh/app/models/bed.rb new file mode 100644 index 0000000..a6f78ee --- /dev/null +++ b/rvh/app/models/bed.rb @@ -0,0 +1,4 @@ +class Bed < ApplicationRecord + belongs_to :care_centre + belongs_to :patient +end diff --git a/rvh/db/migrate/20200315182108_create_beds.rb b/rvh/db/migrate/20200315182108_create_beds.rb new file mode 100644 index 0000000..50607da --- /dev/null +++ b/rvh/db/migrate/20200315182108_create_beds.rb @@ -0,0 +1,11 @@ +class CreateBeds < ActiveRecord::Migration[6.0] + def change + create_table :beds do |t| + t.string :room_number + t.references :care_centre, null: false, foreign_key: true + t.references :patient, null: true, foreign_key: true + + t.timestamps + end + end +end diff --git a/rvh/db/schema.rb b/rvh/db/schema.rb index d333f5e..b48c882 100644 --- a/rvh/db/schema.rb +++ b/rvh/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: 2020_03_15_181211) do +ActiveRecord::Schema.define(version: 2020_03_15_182108) do create_table "accounts", force: :cascade do |t| t.string "name", null: false @@ -21,6 +21,16 @@ ActiveRecord::Schema.define(version: 2020_03_15_181211) do t.datetime "updated_at", precision: 6, null: false end + create_table "beds", force: :cascade do |t| + t.string "room_number" + t.integer "care_centre_id", null: false + t.integer "patient_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["care_centre_id"], name: "index_beds_on_care_centre_id" + t.index ["patient_id"], name: "index_beds_on_patient_id" + end + create_table "care_centres", force: :cascade do |t| t.string "employee_type", null: false t.integer "employee_id", null: false @@ -47,5 +57,7 @@ ActiveRecord::Schema.define(version: 2020_03_15_181211) do t.index ["account_id"], name: "index_patients_on_account_id" end + add_foreign_key "beds", "care_centres" + add_foreign_key "beds", "patients" add_foreign_key "patients", "accounts" end |
