From 8c4cdd41b41c30a08b5e9fc1d76100a034ebfd51 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sun, 15 Mar 2020 12:02:08 -0600 Subject: Create patients table --- rvh/app/models/patient.rb | 3 +++ rvh/db/migrate/20200315180103_create_patients.rb | 10 ++++++++++ rvh/db/schema.rb | 11 ++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 rvh/app/models/patient.rb create mode 100644 rvh/db/migrate/20200315180103_create_patients.rb 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 -- cgit v1.2.3