Skip to content

Instantly share code, notes, and snippets.

@edwardloveall
Created November 2, 2017 17:11
Show Gist options
  • Select an option

  • Save edwardloveall/f87ff848b574b24434c55fb7e95384f9 to your computer and use it in GitHub Desktop.

Select an option

Save edwardloveall/f87ff848b574b24434c55fb7e95384f9 to your computer and use it in GitHub Desktop.
class AddDirectionToVotes::V20171102095010 < LuckyMigrator::Migration::V1
def migrate
alter :votes do
add positive : Bool?
end
execute "UPDATE votes SET positive = 'true';"
execute "ALTER TABLE votes ALTER COLUMN positive SET NOT NULL;"
end
def rollback
alter :votes do
remove :positive
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment