Changeset View
Changeset View
Standalone View
Standalone View
docs/db.rst
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | |||||
- the initialization and migration scripts should not create nor fill the | - the initialization and migration scripts should not create nor fill the | ||||
metadata related tables (``dbversion`` and ``dbmodule``). | metadata related tables (``dbversion`` and ``dbmodule``). | ||||
- the package should provide a ``get_datastore`` function in its root namespace | - the package should provide a ``get_datastore`` function in its root namespace | ||||
returning an instance of the datastore object. Normally, this datastore | returning an instance of the datastore object. Normally, this datastore | ||||
object uses ``swh.core.db.BaseDb`` to interact with the actual database. | object uses ``swh.core.db.BaseDb`` to interact with the actual database. | ||||
- The datastore object should provide a ``current_version`` attribute returning the | - The datastore object should provide a ``get_current_version()`` method | ||||
database version expected by the code. | returning the database version expected by the code. | ||||
See existing ``swh`` packages like ``swh.storage`` or ``swh.scheduler`` for | See existing ``swh`` packages like ``swh.storage`` or ``swh.scheduler`` for | ||||
usage examples. | usage examples. | ||||
Writing tests | Writing tests | ||||
------------- | ------------- | ||||
The ``swh.core.db.pytest_plugin`` provides a few helper tools to write unit | The ``swh.core.db.pytest_plugin`` provides a few helper tools to write unit | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |