12.27.07

Resolved: SQLite3::SQLException: SQL logic error or missing database

Posted in Ruby, sqlite3 at 11:00 am by Robert Horvick

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:

  1. Check that test.sqlite3 exists.
  2. Rebuild test.sqlite3 using “rake db:reset”
  3. retry … still failed.
  4. 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.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]