diff options
author | Olly Cope <olly@ollycope.com> | 2019-07-25 11:01:38 +0000 |
---|---|---|
committer | Olly Cope <olly@ollycope.com> | 2019-07-25 11:01:38 +0000 |
commit | 04c1868d6e4e35eea94f520ff7b138db9c9a127a (patch) | |
tree | 64a32c075a054a7456b1b7bedcb0d65c9ff6ef22 /doc | |
parent | b6b168b7cd950d9b0ef35cd41625fc9a6bf92994 (diff) | |
download | yoyo-04c1868d6e4e35eea94f520ff7b138db9c9a127a.tar.gz |
docs: add example for calling rollback from python code
Thanks to Alfred Nutile for the suggestion
Diffstat (limited to 'doc')
-rw-r--r-- | doc/index.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/index.rst b/doc/index.rst index 2d27ebc..3c3515a 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -334,9 +334,15 @@ The following example shows how to apply migrations from inside python code: backend = get_backend('postgres://myuser@localhost/mydatabase') migrations = read_migrations('path/to/migrations') + with backend.lock(): + + # Apply any outstanding migrations backend.apply_migrations(backend.to_apply(migrations)) + # Rollback all migrations + backend.rollback_migrations(backend.to_rollback(migrations)) + .. :vim:sw=4:et .. toctree:: |