Make 'swh db init' fill the dbversion table
for this feature to work properly, the backend datastore package must provide the 'get_datastore' factory function in its root namespace and the datastore instance must provide a 'get_current_version()' method.
This also means the canonical cli usage for the swh db init
is now
using the config file (via --config-file
or SWH_CONFIG_FILENAME
)
instead of giving only the db cnx string (--db-name
), so that the
backend datastore class can be instanciated using the get_datastore()
factory function.
However a '--initial-version' cli option has been added to 'swh db init' to make it easier, especially for unit tests.
Also use a standard postgresql db fixture in test_cli instead of a custom 'test_db' (which did not truncate dbversion and origin tables, not sure what the intent was for this).
Depends on !315 (closed) Related to #3894 (closed)
Migrated from D7063 (view on Phabricator)