UniStuttgart-VISUS / damast

Code for the DH project "Dhimmis & Muslims – Analysing Multireligious Spaces in the Medieval Muslim World" (VolkswagenFoundation)
MIT License
10 stars 1 forks source link

Add a database version history for semi-static instances #97

Closed mfranke93 closed 2 years ago

mfranke93 commented 2 years ago

Damast instances that use the report eviction feature assume that the underlying database contents never change. Otherwise, the content of the report might differ after re-creation out of the evicted state. For link-able, reference-able reports, that could be bad (depending on the extent of those changes). The eviction feature was not meant to be used on systems with a changing database, but smaller additions such as discussed in #91 could still happen, and would affect the report contents.

The changes should not be large in such situations, but it is still necessary to communicate in re-created reports that the data has changed. The idea would be to

  1. Add a database_version table to the reports.db database which contains some metadata about the incrementally-numbered versions of the PostgreSQL database. One structure proposal would be:

    CREATE TABLE database_version (
     version INTEGER NOT NULL PRIMARY KEY,
     date DATE NOT NULL,
     description TEXT NOT NULL
    );
  2. On each data update to the instance, add a respective entry to the database_version table.

  3. Store the version a report was generated with in the reports table.

  4. On re-generation, if the last version in the table is not the same as the one the report was generated with, add a disclaimer section to the report content detailing the version history as extracted from that table, and marking clearly the original and current version.

@rpbarczok @tutebatti : Thoughts?

tutebatti commented 2 years ago

Sounds good!