Skip to content

Instantly share code, notes, and snippets.

@digitalm
Last active April 6, 2018 01:47
Show Gist options
  • Save digitalm/4e0e735d53c11395a0d7fccbfef7299c to your computer and use it in GitHub Desktop.
Save digitalm/4e0e735d53c11395a0d7fccbfef7299c to your computer and use it in GitHub Desktop.
ActiveRecord::Migration で string のカラムをデータごと integer に変換する ref: https://qiita.com/digitalm/items/919908bdb152c3a068e9
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