Created
January 24, 2013 09:52
-
-
Save m2web/4619356 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 AddSequenceToTableName < ActiveRecord::Migration | |
def up | |
#add sequence to | |
execute <<-SQL | |
ALTER TABLE table_name ALTER COLUMN id SET DEFAULT nextval('table_name_id_seq'::regclass); | |
SQL | |
end | |
def down | |
execute <<-SQL | |
ALTER TABLE table_name ALTER COLUMN id SET NOT NULL; | |
SQL | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment