I have a git repo that has a single .sqlite file.

It's a special DB in that it only ever has new values added; nothing is ever changed or removed. But it is possible that two branches will have the same data entered (same primary key, same values). I have code written, merge_db.py, that will merge two versions of that database into one.

What I'm looking for is a foolproof way to automatically merge these on a git pull or git merge action.

Are git hooks, like a pre-merge hook appropriate for this? If so, it appears this hook does not get copied with a git clone. Is there a way to pull it down with a git clone? Again, I'm looking to make it foolproof so that each user can simply clone the repo and use it with commit, push, pull.

Note: I'm not using a proper multi-user database like Postgres because I need it to be duplicated for each user, and available offline.

0 Answers