From time to time, when running integration tests you'll notice that tests that worked previously have stopped working. Trying to modify the schema of an SQLite database is throwing an error. The dreaded:
Error (11) malformed database
Fortunately, there's quite an easy fix. Simply head to the command line, and use the following commands:
sqlite3 yourdatabase.sqlite .mode insert .output schema.sql .dump .exit
You now how a full sql dump of your sqlite database's schema (and contents). Open up the new schema.sql file
and fix any issues that you can see. For me, I noticed that there was a mismatch of `
and "
characters.
If you're using OSX, use sqlitebrowser to simply execute the new cleaned SQL and save the new database file.