Using SQLite-manager (in its XUL form) on a Mac.
How can I diff a SQLite file from one submitted by someone else on the team, and incorporate his changes?
Thanks.
Using SQLite-manager (in its XUL form) on a Mac.
How can I diff a SQLite file from one submitted by someone else on the team, and incorporate his changes?
Thanks.
I believe you could use the following, in combination:
$ diff sqlite-file-1.sql sqlite-file-2.sql > sqlite-patch.diff
$ patch -p0 sqlite-file-1.sql sqlite-patch.diff
I hope that works for you. Otherwise, I highly suggest consulting the man-pages:
$ man diff
$ man patch
EDIT: Alright, here's the whole walk-through.
First, dump the databases:
$ sqlite test1.sql .dump > test1.sql.txt
$ sqlite test2.sql .dump > test2.sql.txt
Next, generate a diff file:
$ diff -u test1.sql.txt test2.sql.txt > patch-0.1.diff
And, finally, to apply the patch:
$ patch -p0 test1.sql.txt patch-0.1.diff
We can use the sqldiff Utility Program:
https://www.sqlite.org/sqldiff.html
It will compare the source to the destination databases and generate SQL commands to make source equivalent to destination.
- Any differences in the content of paired rows are output as UPDATEs.
- Rows in the source database that could not be paired are output as DELETEs.
- Rows in the destination database that could not be paired are output as INSERTs.
We have to download the sources and compile it, from the tool folder.
tool
folder. Just ./configure && make sqldiff
. –
Playboy Maybe using this tool: http://download.cnet.com/SQLite-Diff/3000-10254_4-10894771.html ? But you can use the solution provided by @indienick provided you first dump the binary sqlite database with something like: sqlite x.db .dump > output.sql
Hope this helps, Moszi
There is a free web tool to compare SQLite databases, both schema and data - https://ksdbmerge.tools/for-sqlite-online Works on wasm-compatible browsers including Safari on Mac.
I am the author of that tool, it is an uno-platform port of my desktop tool for SQLite. Unlike few other online tools I could find - it does not upload your data to the server to generate data diff. However it uploads schema to handle the rest of logic.
As of June 2022 it is diff-only tool, web version does not produce any syncronization scripts.
© 2022 - 2024 — McMap. All rights reserved.