26 lines
537 B
Ruby
26 lines
537 B
Ruby
|
class Init < ActiveRecord::Migration
|
||
|
def up
|
||
|
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'
|
||
|
end
|
||
|
end
|