diff options
author | Olly Cope <olly@ollycope.com> | 2022-10-02 18:03:38 +0000 |
---|---|---|
committer | Olly Cope <olly@ollycope.com> | 2022-10-02 18:03:38 +0000 |
commit | 67160446adfedc322b632ff92bfe8a1f843d881a (patch) | |
tree | 320e67913ad678bb7bda83388242d8bd796898b1 | |
parent | 8c99cbba85e509a13e6872e0d826a289be52a236 (diff) | |
download | yoyo-67160446adfedc322b632ff92bfe8a1f843d881a.tar.gz |
docs: add instructions for creating custom backends
-rw-r--r-- | doc/index.rst | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/index.rst b/doc/index.rst index bfd8326..ca82512 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -515,6 +515,32 @@ The following example shows how to apply migrations from inside python code: :maxdepth: 2 :caption: Contents: + +Adding custom backends +====================== + +Backends are discovered using Python importlib.metadata entry points. + +To add a custom backend, create a python package containing a subclass of +:class:`yoyo.backends.base.DatabaseBackend` and configure it +in the package metadata (typically in ``setup.cfg``), for example: + +.. code:: ini + + [options.entry_points] + + yoyo.backends = + mybackend = mypackage:MyBackend + + +You can then use the backend by specifying ``'mybackend'`` as the driver +protocol:: + + .. code:: sh + + yoyo apply --database my_backend://... + + Contributing ============= |