A tool that converts sqlite to/from git-friendly format
This is a tool made by me and made for me, to solve a very specific problem: version-control sqlite.
I love git and sqlite. Both are very reliable and feature-rich. I use them a lot. One problem is that it's very difficult to version-control an sqlite DB with git. You can add the database file to the git repository, but git's not very good at dealing with binary files. You can't git diff binary files, you can't git blame them. Also, git works better with many small files than a single huge file.
So I made this tool. I'm satisfied with it, and I hope you like it too!
How to install
- Build from source
- Build with cargo
- Use pre-built binaries
Coming soon!
How to use
git commityour database
# This will create a directory `db/` and dump the data to the directory.
# If `db/` already exists, it removes files in the directory. So be careful!
# Then, run whatever git command you want.
git checkoutolder version of your database
# Let's assume that `db/` is an output of `stfg to-git` command.
# It overwrites `your-database.db` if it already exists.
# Now `your-database.db` contains an older version of your data.
git diffbetween 2 versions of your database
# Let's assume that `db/` is an output of `stfg to-git` command.
# stfg creates a subdirectory per table under `db/`, so you can
# easily browse the contents of each table.
FAQ
- Why not just use
.dumpcommand of sqlite?
Yeah that works, and many of you might find that better than my solution. But I think my solution is more git-friendly because 1) it splits the database into small files instead of creating a single huge file and 2) it guarantees each field of the database is exactly one line in a file.
- Can I use this in production?
I don't think so. It's my personal project. There must be a lot of rough edges. Feedbacks and contributions are welcome!!