Created
July 14, 2014 03:50
-
-
Save tbaba/240df6ed23e9fe9e0e95 to your computer and use it in GitHub Desktop.
DBのマイグレーション時に、changeでupとdownを表現する方法 ref: http://qiita.com/tbaba/items/3e7b62929894a0bfe4cd
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 ChangeColumnTypeOfTwitterId < ActiveRecord::Migration | |
def change | |
reversible do |r| | |
change_table :users do |t| | |
r.up { t.change :twitter_id, :integer, limit: 8 } | |
r.down { t.change :twitter_id, :string } | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment