Skip to content

Instantly share code, notes, and snippets.

@MarkPochert
Created January 18, 2011 10:52
Show Gist options
  • Save MarkPochert/784287 to your computer and use it in GitHub Desktop.
Save MarkPochert/784287 to your computer and use it in GitHub Desktop.
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