Created
February 6, 2018 16:26
-
-
Save gabidavila/d02684d411eee9cdbbc87470e9282825 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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