A
A
Alexander2014-05-04 13:37:46
Ruby on Rails
Alexander, 2014-05-04 13:37:46

How to delete a table if rollback fails?

Image%202014-05-04%20at%201.33.27%20%D0%
Rollback does not work, I thought it would work if I divided the migration, but alas.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
JustANobody, 2014-05-04
@Aice

If necessary, through migration, create an empty migration DeleteComments and write in it drop_table :commentsThen run the migration.
Here is the details api.rubyonrails.org/classes/ActiveRecord/Migration.html
Or you can without migration, start the rails console and type
ActiveRecord::Migration.drop_table(:comments)

D
Dima, 2014-05-04
@MAXOPKA

And if you try to delete the model?

A
Andrew Emelianenko, 2014-05-06
@YourWest

Create "correct" migrations with up and down methods, you can read more details here: selectedproblems.blogspot.com/2011/09/rails-migrat...
If you had a "correct" migration, you could write rake db to rollback :rollback

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question