0

I want to modify the data type from string to text, and I followed the tutorial from

Changing a column type to longer strings in rails

and run rake db:migrate and rake db:rollback but it gave me an error message

== 20160203133535 ChangeNameToProfessors: migrating =========================== -- change_column(:professors, :name, :text) rake aborted! StandardError: An error has occurred, this and all later migrations canceled:

How can I solve it?

thank for answering!

Community
  • 1
  • 1
Champer Wu
  • 1,101
  • 3
  • 13
  • 32

1 Answers1

0

If you just want to change a single column:

def change
  change_column :table_name, :column_name, :text
end

If you want to perform a rollback, then first perform the rollback before changing your (already existing) migration file. You cannot perform a rollback with a changed migration file, this is what likely happens in your scenario.

After the rollback change the migration file to the correct (new) column, and migrate again.

Laurens
  • 2,420
  • 22
  • 39
  • OP did, as I see in the error message `change_column(:professors, :name, :text)`. something wrong in other place or I dunno. – Arup Rakshit Feb 03 '16 at 14:49