Created
May 31, 2012 02:50
-
-
Save sycobuny/2840644 to your computer and use it in GitHub Desktop.
Eric's Migrations for RSVPs yayyy
This file contains hidden or 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
Sequel.migration do | |
change do | |
create_table :guests | |
primary_key :id | |
String :first_name, :null => false | |
String :last_name, :null => false | |
String :street | |
String :city | |
String :state, :length => 2 | |
String :zip, :length => 5 | |
TrueClass :invitation_sent, :null => false, :default => false | |
TrueClass :coming, :null => false, :default => true | |
Integer :extra_guests, :null => false, :default => 0 | |
# not strictly necessary, if you want to build/test on sqlite and this doesn't | |
# work you can probably comment it out. it guarantees that the only people who | |
# can have extra guests are people who are actually coming. | |
check do | |
( | |
{:coming => false} & | |
{:extra_guests => 0} | |
) | | |
{:coming => true} | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment