summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rvh/app/models/shift.rb4
-rw-r--r--rvh/db/migrate/20200315182410_create_shifts.rb12
-rw-r--r--rvh/db/schema.rb15
3 files changed, 30 insertions, 1 deletions
diff --git a/rvh/app/models/shift.rb b/rvh/app/models/shift.rb
new file mode 100644
index 0000000..df7adc2
--- /dev/null
+++ b/rvh/app/models/shift.rb
@@ -0,0 +1,4 @@
+class Shift < ApplicationRecord
+ belongs_to :care_centre
+ belongs_to :employee
+end
diff --git a/rvh/db/migrate/20200315182410_create_shifts.rb b/rvh/db/migrate/20200315182410_create_shifts.rb
new file mode 100644
index 0000000..7a7cca5
--- /dev/null
+++ b/rvh/db/migrate/20200315182410_create_shifts.rb
@@ -0,0 +1,12 @@
+class CreateShifts < ActiveRecord::Migration[6.0]
+ def change
+ create_table :shifts do |t|
+ t.references :care_centre, null: false, foreign_key: true
+ t.references :employee, null: false, foreign_key: true
+ t.datetime :started_at, null: false
+ t.datetime :ended_at
+
+ t.timestamps
+ end
+ end
+end
diff --git a/rvh/db/schema.rb b/rvh/db/schema.rb
index b48c882..8b5cdf9 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_182108) do
+ActiveRecord::Schema.define(version: 2020_03_15_182410) do
create_table "accounts", force: :cascade do |t|
t.string "name", null: false
@@ -57,7 +57,20 @@ ActiveRecord::Schema.define(version: 2020_03_15_182108) do
t.index ["account_id"], name: "index_patients_on_account_id"
end
+ create_table "shifts", force: :cascade do |t|
+ t.integer "care_centre_id", null: false
+ t.integer "employee_id", null: false
+ t.datetime "started_at"
+ t.datetime "ended_at"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["care_centre_id"], name: "index_shifts_on_care_centre_id"
+ t.index ["employee_id"], name: "index_shifts_on_employee_id"
+ end
+
add_foreign_key "beds", "care_centres"
add_foreign_key "beds", "patients"
add_foreign_key "patients", "accounts"
+ add_foreign_key "shifts", "care_centres"
+ add_foreign_key "shifts", "employees"
end