~olly/yoyo#84: 
Running from Python Code

I have a CLI tool that is backed by an SQLite database. I want the database to be updated to the latest schema every time the tool is invoked. Following the docs, I assumed that calling

backend = get_backend("sqlite:///listenbrainz.db")
migrations = read_migrations("./migrations")
with backend.lock():
    backend.apply_migrations(backend.to_apply(migrations))

from my main function would do exactly that. However, I realized that when trying to run a migration with a syntax error manually (using yoyo apply …), the syntax error was caught (and raised), when calling apply_migrations as outlined in the snippet above, nothing of that sort happened, it just continued silently.

Does apply_migrations fail silently? Can I change that? Is something missing from the way I invoke it?

Thanks in advance!

Status
REPORTED
Submitter
arne@schlueter.is
Assigned to
No-one
Submitted
2 years ago
Updated
2 years ago
Labels
No labels applied.