HomeSoftware Heritage

Add support for dbversion and dbmodule handling in swh db init

This commit no longer exists in the repository. It may have been part of a branch which was deleted.

Description

Add support for dbversion and dbmodule handling in swh db init

for now, managing the dbversion table (storing the db schema upgrade
history) is partially the responsibility of the swh modules implementing
a datastore (swh-storage etc.), and the actual swh module was not stored
in the database.

This adds support for both the dbversion and dbmodule tables management
in swh.core.db.

The swh db init command now creates both these tables and initialize
their values if possible.
For this, it introduces a new common "API" for swh.core.db based datastores:

  • a swh module implementing a datastore is expected to have a get_datastore function in its top namespace; this function is typically the actual get_storage, get_scheduler etc. functions
  • this factory function is expected to use the "postgresql" cls for the datastore based on swh.core.db,
  • the datastore instance (eg. instance of the swh.storage.postgresql.Storage class) is expected to have a get_current_version() method (returning an int).

This revision also provides a new swh db version command displaying
the current (code) version (if available), the db version (possibly the whole
version history) and flavor (if any) for the datastore given as argument.

It should be backward compatible with existing swh datastore modules (i.e.
not yet adapted to this new API).

Details

Provenance
douarddaAuthored on Jan 28 2022, 3:02 PM
douarddaPushed on Feb 17 2022, 1:55 PM
Differential Revision
D7062: Add support for dbversion and dbmodule handling in swh db init
Tasks
T3894: Add a 'swh db upgrade' cli
Build Status
Buildable 26959
Build 42157: test-and-buildJenkins console · Jenkins

Commit No Longer Exists

This commit no longer exists in the repository.