0

I have a migration with many remove_column.

I start it, but there is an error :

-- remove_column(:responses, :text_fr)
-> 0.5544s
-- remove_column(:responses, :text_en)
-> 0.2906s
-- remove_column(:topics, :text_fr)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: Can't DROP 'text_fr'; check that column/key exists

It's my fault because I don't give the good name of column.

But my problem is : there is no automatic rollback !

I have fix the name of column in migration file, but now it's not working because text_fr don't exist in responses table...

I remember before, when an error occur, there was a rollback as if migration had not occurred...

So how enable auto-rollback of migrations?

I'm using mysql2 gem.

Matrix
  • 3,458
  • 6
  • 40
  • 76

1 Answers1

1

Since MySQL does not support transaction, implement up and down methods for your migrations.

Community
  • 1
  • 1
Raj
  • 22,346
  • 14
  • 99
  • 142