top | item 41966268

(no title)

earthboundkid | 1 year ago

I'm continually going through this thought process:

1. I should make blog engine using flat files. That way I can diff the plain text.

2. But flat files are hard to read/write structured data from, so I should use SQLite instead.

3. But SQLite is hard to diff. GOTO 1.

discuss

order

crazygringo|1 year ago

In every project of mine with databases, I use a tool to export the schema (without data) as a text SQL file on every commit (as a pre-commit hook), to record any changes.

There's no reason you can't do the same but including the content too.

That way you're always committing a text friendly version of the database rather than the database binary encoding. And your diffs will work great.

sureglymop|1 year ago

But with sqlite would it be that hard? You could use sqldiff or, even something like this:

diff <(sqlite3 db 'select text from posts where id = 1') <(sqlite3 db 'select text from posts where id = 2')

ajayvk|1 year ago

There is a `version files` command to list the files for a version, including the SHA. I plan to add an export command also to make diff easier