runtime
486 / 500
question 486 Application Delivery · medium

The migration that claims too much

After a failed deploy, the database reports schema version 3, yet the payments table that migration 3 creates doesn't exist, and the readiness check passes because the version looks right. Fix migrate so a migration that fails leaves the database exactly as it was before that migration, version included, and the error still reaches the caller.

Read and diagnose: this can't run in the browser, so you'll read real code and output and answer questions about it.

Functionmigrate(conn, migrations); conn uses isolation_level=None
Ruleeach pending version runs in its own transaction with its PRAGMA user_version; a failing statement rolls the whole version back and the error is re-raised
Returnsthe versions applied by this call

Loading your progress…

The migration that claims too much — Python practice · Runtime