12.27.07
Resolved: SQLite3::SQLException: SQL logic error or missing database
After doing some cleanup I reset my Sqlite3 databases and tried to run tests to make sure that everything was still ok. The command I ran was:
$ rake test
and the output from each test was a failure with the message:
34) Error: test_should_update_user(UsersControllerTest): SQLite3::SQLException: SQL logic error or missing database
So I did the following:
- Check that test.sqlite3 exists.
- Rebuild test.sqlite3 using “rake db:reset”
- retry … still failed.
- Try loading fixtures using “rake db:fixtures:load”
C:\InstantRails\rails_apps\atompublog>rake db:fixtures:load (in C:/InstantRails/rails_apps/atompublog) rake aborted! SQLite3::SQLException: no such table: atom_entries: DELETE FROM atom_entries WHERE 1=1 (See full trace by running task with --trace)
Ah ha!
That table shouldn’t exist (and it doesn’t…) so there should not be a fixture loading into it.
I checked my fixtures and there was one named “atom_entries.yml”. After deleting that file the fixtures loaded, the tests ran and I was confident that my cleanup changes did not break anything.
A quick google search shows that a lot of people have hit this problem so hopefully this post helps some of them track down one of the potential causes.