Rails add_test_data migration
Just working through the Agile Web Development with Rails book and near the closing chapters of the book I had to rollback the db a few times using db:migrate VERSION=0 followed by the db:migrate command. However upon bringing the database back from the ground up开发者_如何学运维, the add_test_data migration fails to add the test entries to the db as it had successfully done previously. Any Ideas? Im getting the following in the development log
Migrating to AddTestData (20091111225948)
[4;36;1mSQL (0.0ms)[0m [0;1mselect sqlite_version(*)[0m
[4;35;1mProduct Load (1.0ms)[0m [0m
SELECT "products".id FROM "products" WHERE ("products"."title" = 'Pragmatic Project Automation') LIMIT 1[0m
[4;36;1mProduct Load (0.0ms)[0m [0;1mSELECT "products".id FROM "products" WHERE ("products"."title" = 'Pragmatic Version Control') LIMIT 1[0m
[4;35;1mProduct Load (1.0ms)[0m [0mSELECT "products".id FROM "products" WHERE ("products"."title" = 'Pragmatic Unit Testing (C#)') LIMIT 1[0m
[4;36;1mSQL (1.0ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('20091111225948')[0m
The db is SQLite3, Ruby 1.8.6, Rails 2.3.4 and im developing on Windows (cringe)
Since you're using 2.3.4 I would use db:seed to add seed data.
Short of that I'd try renaming your sqlite database and running rake db:migrate again against an empty database. You might have to create a new empty development.sqlite3.
If neither of these work for you posting the contents of the migration would help.
精彩评论