Last active
April 6, 2018 01:47
-
-
Save digitalm/4e0e735d53c11395a0d7fccbfef7299c to your computer and use it in GitHub Desktop.
ActiveRecord::Migration で string のカラムをデータごと integer に変換する ref: https://qiita.com/digitalm/items/919908bdb152c3a068e9
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
def up | |
change_column :reports, :file_size, 'integer USING CAST(file_size AS integer)' | |
end | |
def down | |
change_column :reports, :file_size, :string | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment