0
0

Rails - DBの stringe のカラムを integer に変換する

Posted at

ネットで調べると using を使う例が出てくるが、自分のRails環境では以下だけで良かった

class ExampleMigration < ActiveRecord::Migration[7.1]
  def up
    change_column :table_name, :column_name, :integer
  end

  # ロールバック用 
  def down
    change_column :table_name, :column_name, :string
  end
end

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

プロフィール・経歴

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0