Skip to content

Instantly share code, notes, and snippets.

@gabidavila
Created February 6, 2018 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabidavila/d02684d411eee9cdbbc87470e9282825 to your computer and use it in GitHub Desktop.
Save gabidavila/d02684d411eee9cdbbc87470e9282825 to your computer and use it in GitHub Desktop.
class CreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
t.string :name
t.timestamps
end
end
end
class CreateAddresses < ActiveRecord::Migration[5.1]
def change
create_table :addresses do |t|
t.text :street
t.string :city
t.string :state
t.string :zipcode
t.integer :user_id
t.timestamps
end
add_foreign_key :addresses, :users
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment