Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparing 2 SQLite databases

Tags:

sqlite

I would like to compare 2 SQLite databases in order to check whether it needs to be updated on the client computer.

I am not really sure how I should do this. Whether I should make an internal version ID or compare the file size (which probally is not a good idea because I think the file size doesn't change anytime I edit the database).

Does anybody know a good way to do what I need to do?

Thank you!

like image 755
Maiken Roskilde Avatar asked Jan 06 '23 02:01

Maiken Roskilde


1 Answers

You might try dumping each SQLite database, using SQLite's .dump command:

$ sqlite3 /path/to/database1 .dump > database1.sql
$ sqlite3 /path/to/database2 .dump > database2.sql

And then comparing the generated files. If your two databases are quite similar, a simple diff might work to show any differences, e.g.:

$ diff -u database1.sql database2.sql

Hope this helps!

like image 155
Castaglia Avatar answered Mar 30 '23 08:03

Castaglia