カラムのデフォルト値を変更するにはマイグレーションファイルに以下のように記述します。
def change
change_column_default テーブル名, カラム名, from: 元のデフォルト値, to: 変更後のデフォルト値
end
users
テーブルのis_sample
カラムのデフォルト値をfalse
からtrue
に変更する場合は以下のようになります。
def change
change_column_default :users, :is_sample, from: false, to: true
end