diff --git a/app/models/patient.rb b/app/models/patient.rb new file mode 100644 index 0000000..9476fd5 --- /dev/null +++ b/app/models/patient.rb @@ -0,0 +1,3 @@ +class Patient < ActiveRecord::Base + belongs_to :user +end diff --git a/db/migrate/20111122142443_create_patients.rb b/db/migrate/20111122142443_create_patients.rb new file mode 100644 index 0000000..928a04d --- /dev/null +++ b/db/migrate/20111122142443_create_patients.rb @@ -0,0 +1,11 @@ +class CreatePatients < ActiveRecord::Migration + def change + create_table :patients do |t| + t.references :user + t.string :name + + t.timestamps + end + add_index :patients, :user_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 25e892d..21838ea 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20111122142342) do +ActiveRecord::Schema.define(:version => 20111122142443) do create_table "organizations", :force => true do |t| t.string "name" @@ -19,6 +19,15 @@ t.datetime "updated_at" end + create_table "patients", :force => true do |t| + t.integer "user_id" + t.string "name" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "patients", ["user_id"], :name => "index_patients_on_user_id" + create_table "users", :force => true do |t| t.integer "organization_id" t.string "name"