@@ -1274,6 +1274,48 @@ functionality.
12741274.. _detectors:
12751275.. _Auditors and reactors:
12761276
1277+
1278+ Schema Integrity
1279+ ----------------
1280+
1281+ There is a table in all SQL based schemas called ``schema``. It
1282+ contains a representation of the current schema and the current
1283+ Roundup schema version. Roundup will exit the version is not supported
1284+ by the release. E.G. Roundup 2.1.0 will not work with a database
1285+ created by 2.3.0 as db version 8 used by 2.3.0 is not supported by
1286+ 2.1.0.
1287+
1288+ The current schema representation is automatically updated whenever a
1289+ change is made to the schema via ``schema.py``. The schema version is
1290+ upgraded when running ``roundup-admin migrate`` although it can be
1291+ upgraded automatically in some cases by run a Roundup process (mailgw,
1292+ web interface). This information is kept in one large blob in the
1293+ table. To view this in a more understandable format, you can use the
1294+ commands below (requires the jq command):
1295+
1296+ Postgres
1297+ .. code::
1298+
1299+ psql -tq -d 'roundup_db' -U roundup_user -c \
1300+ 'select schema from schema;' | \
1301+ python3 -c 'import json, sys; d = eval(sys.stdin.read()); \
1302+ print(json.dumps(d, indent=2));' | jq . | less
1303+
1304+ replace ``roundup_db``, ``roundup_user`` with the values from
1305+ ``config.ini`` and use a ``~/.pgpass`` file or type the database
1306+ password when prompted.
1307+
1308+ SQLite
1309+ .. code::
1310+
1311+ sqlite3 demo/db/db 'select schema from schema;' | \
1312+ python3 -c 'import json, sys; d = eval(sys.stdin.read()); \
1313+ print(json.dumps(d, indent=2));' | jq . | less
1314+
1315+ Something similar for MySQL can be generated as well.
1316+ Replacing ``jq .`` with ``jq .version`` will display the schema
1317+ version.
1318+
12771319Detectors - adding behaviour to your tracker
12781320============================================
12791321
0 commit comments