comparison doc/reference.txt @ 7459:2e3b5c10c502

Add section on schema integrity, use of schema table in rdbms backends Also record commands I need to dump the table and extract version field.
author John Rouillard <rouilj@ieee.org>
date Wed, 07 Jun 2023 11:10:46 -0400
parents d17e3dce28bc
children 82a0adad2ae6
comparison
equal deleted inserted replaced
7458:fe16ff1bede5 7459:2e3b5c10c502
1271 https://wiki.roundup-tracker.org/CategorySchema 1271 https://wiki.roundup-tracker.org/CategorySchema
1272 1272
1273 .. index:: !detectors 1273 .. index:: !detectors
1274 .. _detectors: 1274 .. _detectors:
1275 .. _Auditors and reactors: 1275 .. _Auditors and reactors:
1276
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.
1276 1318
1277 Detectors - adding behaviour to your tracker 1319 Detectors - adding behaviour to your tracker
1278 ============================================ 1320 ============================================
1279 1321
1280 Detectors are initialised every time you open your tracker database, so 1322 Detectors are initialised every time you open your tracker database, so

Roundup Issue Tracker: http://roundup-tracker.org/