Created
January 18, 2011 10:52
-
-
Save MarkPochert/784287 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 CreateOffers < ActiveRecord::Migration | |
def self.up | |
create_table :offers do |t| | |
t.string :title | |
t.string :description | |
t.integer :seller_id ## The user_id from the seller | |
t.integer :buyer_id ## The user_id from the buyer | |
t.timestamps | |
end | |
end | |
def self.down | |
drop_table :offers | |
end | |
end | |
############# | |
############# | |
In SQL i would write this | |
seller_id integer REFERENCES users(user_id) NOT NULL | |
buyer_id integer REFERENCES users(user_id) DEFAULT NULL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment