Adding schema version to info table in gravity.db

Hi there,

Thank you so much for the Pi-hole, it's been great! I wanted to reach out and see whether a schema version could be added to the info table in the gravity.db SQLite3 file so that anyone reading that DB can know when the structure may have changed?

I run CoreDNS on my home network to give me some redundancy around my Pi-hole node going down, but when that happens I lose my Pi-hole blocks. I'm working on a plugin for CoreDNS to read the gravity.db file, so that if my Pi-hole node goes down I can still do blocking there before forwarding the query to CloudFlare.

Because of this it'd be helpful if I could detect a schema change programmatically and provide a helpful error / log line or to try and support both for a transition period. I think having some sort of version number in the DB would help with that.

Cheers!

$ sqlite3 /etc/pihole/gravity.db
SELECT value FROM info WHERE property = 'version';

>>> 13

:slight_smile:

1 Like

mmm

I thought that was like a running count of the number of times the gravity.db file had been updated. Thank you for clarifying that for me.