2015-09-12 15:37:05 -05:00
|
|
|
class Init < ActiveRecord::Migration
|
2015-09-20 22:30:44 -05:00
|
|
|
def change
|
2015-09-12 15:37:05 -05:00
|
|
|
create_table :people do |t|
|
|
|
|
t.string :first_name
|
|
|
|
t.string :last_name
|
|
|
|
t.string :phone
|
|
|
|
t.string :email
|
|
|
|
t.boolean :admin
|
|
|
|
t.boolean :staff
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :parenthoods do |t|
|
|
|
|
t.integer :person_id
|
|
|
|
t.integer :child_id
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :children do |t|
|
|
|
|
t.string :first_name
|
|
|
|
t.string :last_name
|
|
|
|
end
|
|
|
|
|
|
|
|
add_index :people, :phone
|
|
|
|
add_index :parenthoods, [:person_id, :child_id], name: 'parentship'
|
2015-09-20 22:30:44 -05:00
|
|
|
|
|
|
|
create_table :pages do |t|
|
|
|
|
t.integer :user_id
|
|
|
|
t.integer :person_id
|
|
|
|
t.string :to
|
|
|
|
t.string :message
|
|
|
|
t.string :status
|
|
|
|
t.timestamps null: false
|
|
|
|
end
|
2015-09-12 15:37:05 -05:00
|
|
|
end
|
|
|
|
end
|