Skip to content

Instantly share code, notes, and snippets.

@tbaba
Created July 14, 2014 03:50
Show Gist options
  • Save tbaba/240df6ed23e9fe9e0e95 to your computer and use it in GitHub Desktop.
Save tbaba/240df6ed23e9fe9e0e95 to your computer and use it in GitHub Desktop.
DBのマイグレーション時に、changeでupとdownを表現する方法 ref: http://qiita.com/tbaba/items/3e7b62929894a0bfe4cd
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