Compare 2 SQLite databases

Explanation

Testing a web app, for example with Selenium, might involve a number of CRUD operations on an SQLite database. Given that you do not want to leave the results of the testing in the database it is not a bad idea to try, as part of the test, to reverse all the CRUD operations as part of the testing (possibly as a separate test). It then becomes useful to know if the database has been restored to its original state.

A question on Stackoverflow suggests:


sqlite3 first.sqlite .dump >first.dump
sqlite3 second.sqlite .dump >second.dump
diff first.dump second.dump
    

In addition to diff one can do an md5sum on the two dumps.