| Crates.io | stfg |
| lib.rs | stfg |
| version | 0.1.0 |
| created_at | 2025-08-07 12:56:44.211069+00 |
| updated_at | 2025-08-07 12:56:44.211069+00 |
| description | a tool that converts sqlite to/from git-friendly format |
| homepage | |
| repository | https://github.com/baehyunsol/stfg |
| max_upload_size | |
| id | 1785238 |
| size | 58,674 |
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!
git clone https://github.com/baehyunsol/stfg
cd stfg
cargo build --release
cargo install stfg
Coming soon!
git commit your 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!
stfg to-git your-database.db -o db/
# Then, run whatever git command you want.
git add db
git commit
git checkout older version of your databasegit checkout older-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.
stfg from-git db/ -o your-database.db
# Now `your-database.db` contains an older version of your data.
git diff between 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.
git diff HEAD~1:db/your_table_name HEAD:db/your_table_name
.dump command 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.
I don't think so. It's my personal project. There must be a lot of rough edges. Feedbacks and contributions are welcome!!