I just migrated my create_supplier migration, then I realized that one of my data type was wrong, so I added another migration which looks like this:-
class ChangePhoneToStringInSuppliers < ActiveRecord::Migration[5.1]
def change
change_column :suppliers, :phone_no_1, :string
change_column :suppliers, :phone_no_2, :string
end
end
After migrating this, I realized that I haven`t pushed my code, so ideally I should rollback till create_suppliers migration and add the changes there itself. When I rollback ChangePhoneToStringInSuppliers, I get following error:-
This migration uses change_column, which is not automatically reversible.
To make the migration reversible you can either:
1. Define #up and #down methods in place of the #change method.
2. Use the #reversible method to define reversible behavior.
I think the method suggested in above error message(and other posts on internet) is a prevention to this problem, rather cure(correct me if I am wrong). How can I rollback this migration now?