This is one of two SQLite DB metadata that I really like. I've used `user_version` in the exact same way: I increment it by one every time I change the schema of the database. It's a four-byte signed integer (stored in the DB header in big-endian format), so it supports a large number of possible schema changes.
Folks should also be aware of the `application_id`, another four-byte signed integer accessed via pragma. This is meant to be set once, at the time you create the database. It's a way to ensure that the SQLite DB you are accessing is something that your code created.
For example, I use a line of Python like this to convert some human-readable characters (like 'KARL') into an application ID:
>>> import struct
>>> struct.unpack('=i', struct.pack('cccc', b'K', b'A', b'R', b'L'))[0]
1280459083
So, I'd run `PRAGMA application_id = 1280459083;` when I create the DB. And on first access afterward, I'd run `PRAGMA application_id;`, look at the first (and only) row of output, and check for the expected number.Finally, one thing to note: Because they're part of the database file's header, they are not affected by transactions. So, if you're using `user_version` to track schema changes, a schema upgrade becomes a "stop the world" sort of activity, so you can ensure it took effect.