Skip to content

migrations: Fix upgrade from 3.36.0 with failing migrations

Administrator requested to merge ef/fix-migrator-self-migration into main

Created by: efritz

Fixes #30996 (closed). This issue reported that users of 3.36.0 may write unfinished or failed migration logs which were since hand-resolved by a site-admin. This PR changes the store startup sequence when the database is non-dirty, has no new-style migration logs (any logs written after this commit goes live), and the database schema version is between a set of known migration numbers for which only sequential migrations were defined.

If all those conditions are true, new migration logs from the minimum migration number up to the current database version are written and old ones are discarded.

If any condition is false, the site-admin needs to do something by hand (they already have a dirty database, have migrated successfully to the new version and can write new-style migration logs, or have migrated outside the definitions available from 3.36.0).

Test plan

I'd like to recreate what @caugustus-sourcegraph originally reported by starting up a fresh 3.36.0 instance (that happens to fail), then ensure that an upgrade to 3.37.0 does not complain about the same failure.

Merge request reports

Loading