35 lines
730 B
Ruby
35 lines
730 B
Ruby
class Init < ActiveRecord::Migration
|
|
def change
|
|
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'
|
|
|
|
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
|
|
end
|
|
end
|