Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature request: allow both up/down AND change in migrations #38376
Comments
This comment has been minimized.
This comment has been minimized.
|
We added class AddReservationAcknowledged < ActiveRecord::Migration[5.2]
def change
add_column :reservations, :acknowledged, :boolean, null: false, default: false
up_only do
execute "UPDATE reservations SET acknowledged = true"
end
end
end(if you need both |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Allow both up/down and change in migrations.
I find myself doing this quite often:
For this pattern to be reusable I would expect
upanddowntoyieldwhen thechangeneeds to be executed/reverted, like so:If either up or down is not defined, only execute/revert the
change.