Skip to content

Instantly share code, notes, and snippets.

@sycobuny
Created May 31, 2012 02:50
Show Gist options
  • Save sycobuny/2840644 to your computer and use it in GitHub Desktop.
Save sycobuny/2840644 to your computer and use it in GitHub Desktop.
Eric's Migrations for RSVPs yayyy
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