Using `up_only` in ActiveRecord migrations
The change
method on migrations is great so you don't have to specify up
and down
and if you just want to execute a simple sql update on up
then you can use the up_only method:
def change
add_column :products, :draft, :boolean, default: true
up_only do
execute "update products set draft = false"
end
end
Tweet