summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Cope <olly@ollycope.com>2018-08-17 15:13:28 +0000
committerOlly Cope <olly@ollycope.com>2018-08-17 15:13:28 +0000
commit9417610378593422c9fbb28c55f6748624ddbacf (patch)
tree6731f82b6e08296925a379c4778832bd25e207e7
parenta5b388d1df68aa9abd596c37c6b1da1730ed3aa2 (diff)
downloadyoyo-9417610378593422c9fbb28c55f6748624ddbacf.tar.gz
docs: mark code blocks as python
-rw-r--r--doc/index.rst22
1 files changed, 16 insertions, 6 deletions
diff --git a/doc/index.rst b/doc/index.rst
index ea4ccf8..97806be 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -100,7 +100,9 @@ step should comprise a migration query and (optionally) a rollback query:
)
Migrations may also declare dependencies on earlier migrations via the
-``__depends__`` attribute::
+``__depends__`` attribute:
+
+.. code:: python
#
# file: migrations/0002.modify-foo.py
@@ -125,7 +127,9 @@ Steps may also take an optional argument ``ignore_errors``, which must be one
of ``apply``, ``rollback``, or ``all``. If in the previous example the table
foo might have already been created by another means, we could add
``ignore_errors='apply'`` to the step to allow the migrations to continue
-regardless::
+regardless:
+
+.. code:: python
#
# file: migrations/0001.create-foo.py
@@ -138,7 +142,9 @@ regardless::
)
Steps can also be python functions taking a database connection as
-their only argument::
+their only argument:
+
+.. code:: python
#
# file: migrations/0002.update-keys.py
@@ -251,7 +257,9 @@ you may need to manually intervene to reset the database state
should errors occur in your migration.
Using ``group`` allows you to nest steps, giving you control of where
-rollbacks happen. For example::
+rollbacks happen. For example:
+
+.. code:: python
group([
step("ALTER TABLE employees ADD tax_code TEXT"),
@@ -275,7 +283,7 @@ block. These include:
Migrations containing such statements should set
``__transactional__ = False``, eg:
-.. code::python
+.. code:: python
__transactional__ = False
@@ -287,7 +295,9 @@ Note that this feature is implemented for the PostgreSQL backend only.
Using yoyo from python code
===========================
-The following example shows how to apply migrations from inside python code::
+The following example shows how to apply migrations from inside python code:
+
+.. code:: python
from yoyo import read_migrations
from yoyo import get_backend