Skip to content

Instantly share code, notes, and snippets.

@patrick99e99
Created April 28, 2012 18:09
Show Gist options
  • Save patrick99e99/2520947 to your computer and use it in GitHub Desktop.
Save patrick99e99/2520947 to your computer and use it in GitHub Desktop.
contact migration
class CreateContacts < ActiveRecord::Migration
def self.up
create_table :contacts do |t|
t.string :first_name
t.string :last_name
t.timestamps
end
end
def self.down
drop_table :contacts
end
end
class CreatePhones < ActiveRecord::Migration
def self.up
create_table :phones do |t|
t.string :number
t.references :contact
t.timestamps
end
end
def self.down
drop_table :phones
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment