Skip to content

Refactor the db scaffolding to use swh.core.db

There are several parts in this diff (should be in reasnably correctly splittes git revsions):

  • split the 2 provenance.sql scripts in parts and move them to swh/provenance/sql so the database creation and initialization are handled by the swh db init and swh db create tools from swh.core.db.

  • with/witout path choice is implemented using 2 flavors: with-path and without-path. So the initialization command should be something like:

    swh db init -d db-name --flavor with-path provenance

  • refactor the database creation code and a test for the cli command

  • this later evolution comes with a few changes in the configuration file format to "normalize" it a bit and ease testing:

    • 'ps' config cls for the archive has been renamed as 'direct'
    • 'ps' confif cls for the provenance db has been renamed as 'local' (similar to other swh packages),
    • 'ps_np' has been suppressed in favor of a 'with_path' config flag in the 'provenance' section.
  • also add a provenance fixture in a conftest.py file.


Migrated from D5072 (view on Phabricator)

Merge request reports