diff options
author | Olly Cope <olly@ollycope.com> | 2018-01-29 13:45:05 +0000 |
---|---|---|
committer | Olly Cope <olly@ollycope.com> | 2018-01-29 13:45:05 +0000 |
commit | 265dc7dfb149595af8cdb78e2f77e40b7b880aca (patch) | |
tree | cd79849e236c62403fa2bd466c9aaa96adc46a91 | |
parent | e8f58c64929220a8c9c9fc78132b50aff94ec906 (diff) | |
download | yoyo-265dc7dfb149595af8cdb78e2f77e40b7b880aca.tar.gz |
Add note to readme about backend.lock
-rwxr-xr-x | README.rst | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -332,10 +332,12 @@ Using yoyo from python code The following example shows how to apply migrations from inside python code:: - from yoyo import read_migrations, get_backend + from yoyo import read_migrations + from yoyo import get_backend backend = get_backend('postgres://myuser@localhost/mydatabase') migrations = read_migrations('path/to/migrations') - backend.apply_migrations(backend.to_apply(migrations)) + with backend.lock(): + backend.apply_migrations(backend.to_apply(migrations)) .. :vim:sw=4:et |