summaryrefslogtreecommitdiff
path: root/rvh/db
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-03-15 12:22:11 -0600
committermo khan <mo.khan@gmail.com>2020-03-15 12:22:11 -0600
commitbf125e55535a1002e3e2c66b201727303df3c0b7 (patch)
tree56c382fa8cc94f255dd52014af6b264d4e008815 /rvh/db
parent87ef7d3c9cab6958c7d2c480edfe619bcab36e80 (diff)
Create beds
Diffstat (limited to 'rvh/db')
-rw-r--r--rvh/db/migrate/20200315182108_create_beds.rb11
-rw-r--r--rvh/db/schema.rb14
2 files changed, 24 insertions, 1 deletions
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