diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-15 12:02:08 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-03-15 12:02:08 -0600 |
| commit | 8c4cdd41b41c30a08b5e9fc1d76100a034ebfd51 (patch) | |
| tree | f8bcbc5a3183d2cb535ca9d16cb874b0735abfd0 | |
| parent | 8355efa1dc4fc16cfe2bce3c8d72b7a0b2912f21 (diff) | |
Create patients table
| -rw-r--r-- | rvh/app/models/patient.rb | 3 | ||||
| -rw-r--r-- | rvh/db/migrate/20200315180103_create_patients.rb | 10 | ||||
| -rw-r--r-- | rvh/db/schema.rb | 11 |
3 files changed, 23 insertions, 1 deletions
diff --git a/rvh/app/models/patient.rb b/rvh/app/models/patient.rb new file mode 100644 index 0000000..fd7c3ba --- /dev/null +++ b/rvh/app/models/patient.rb @@ -0,0 +1,3 @@ +class Patient < ApplicationRecord + belongs_to :account +end diff --git a/rvh/db/migrate/20200315180103_create_patients.rb b/rvh/db/migrate/20200315180103_create_patients.rb new file mode 100644 index 0000000..f2ab2ca --- /dev/null +++ b/rvh/db/migrate/20200315180103_create_patients.rb @@ -0,0 +1,10 @@ +class CreatePatients < ActiveRecord::Migration[6.0] + def change + create_table :patients do |t| + t.references :account, null: false, foreign_key: true + t.datetime :contacted_at, null: false + + t.timestamps + end + end +end diff --git a/rvh/db/schema.rb b/rvh/db/schema.rb index c875a31..d390d0a 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_175547) do +ActiveRecord::Schema.define(version: 2020_03_15_180103) do create_table "accounts", force: :cascade do |t| t.string "name", null: false @@ -21,4 +21,13 @@ ActiveRecord::Schema.define(version: 2020_03_15_175547) do t.datetime "updated_at", precision: 6, null: false end + create_table "patients", force: :cascade do |t| + t.integer "account_id", null: false + t.datetime "contacted_at", null: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["account_id"], name: "index_patients_on_account_id" + end + + add_foreign_key "patients", "accounts" end |
