Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On Migration: undefined method `to_sym' for nil:NilClass

I'm running Rails 3.0.3 and I accidentally made a typo in my migration: I created a migration that creates a new column with a type of boolen (it should have been boolean). I ran the migration and Rails didn't warn me that this was an invalid type of column, which I could have sworn it did in previous versions?

Now whenever I try to add, remove, or modify anything in a migration I get the following error:

undefined method `to_sym' for nil:NilClass

I can't even rollback or drop. I have an earlier version of the database and file tree saved, but this problem is driving me crazy because it isn't the first time I've seen this happen.

How can I effectively remove the column without having Rails complain (and preferably without digging into the database by hand)?

like image 221
Eric R. Avatar asked Jan 08 '11 15:01

Eric R.


1 Answers

If you are using the SQLite database, you probably getting this error because SQLLite doesn't provide the drop column feature. http://www.sqlite.org/faq.html#q11

SQLLite suggests that you create a temporary table with only the columns that you need from your original table, transfer data, and then swap the tables.

like image 147
vorak Avatar answered Oct 20 '22 00:10

vorak