summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Cope <olly@ollycope.com>2022-10-02 18:03:38 +0000
committerOlly Cope <olly@ollycope.com>2022-10-02 18:03:38 +0000
commit67160446adfedc322b632ff92bfe8a1f843d881a (patch)
tree320e67913ad678bb7bda83388242d8bd796898b1
parent8c99cbba85e509a13e6872e0d826a289be52a236 (diff)
downloadyoyo-67160446adfedc322b632ff92bfe8a1f843d881a.tar.gz
docs: add instructions for creating custom backends
-rw-r--r--doc/index.rst26
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
=============