Apologies for what is probably a very basic question–but whatever
obvious thing I’m missing continues to elude me.
Rails 2.3.2 and SQLite3
I create a new project with a single basic scaffold, migrate the
database, and run test. Everything passes. Create a migration that
does a single rename_column operation, and migrate again. Now test
fails with an SQLException Table X has no column named [oldname]. I
don’t believe it is a reserved name situation, and I cannot tell what
else might be going on. This test case is boiled down so much I just
don’t see where I’m doing anything weird. Help?
Step by Step:
rails testBreaker
cd TestBreaker (yeah windows, I know…)
ruby script/generate scaffold safeName testOne:string testTwo:string
rake db:migrate
rake test:units
[success]
ruby script/generate migration break_it_with_rename
[edit to include rename_column :safe_names, :testTwo, :broken]
rake db:migrate
rake test:units
[FAIL like this:
test_the_truth(SafeNameTest): ActiveRecord::StatementInvalid:
SQLite3::SQLException: table safe_names has no column named testTwo:
INSERT INTO “safe_names” (“updated_at”, “testOne”, “id”, “testTwo”,
“created_at”) VALUES (‘2009-10-17 00:27:32’, ‘MyString’, 996332877,
‘MyString’, ‘2009-10-17 00:27:32’)]