Columbia Games · CCM v2 / August 2026 26.

The backfill was fast. Too bad the schema had to exist first.

For the library-history migration, schema creation and backfill became an explicit dependency. Unordered variants were removed and versioned migration IDs recorded the only valid execution order.

2 min read
Columbia Games · CCM v2
databasemigrationbackfillordering

Situation

Two data-migration scripts can each be perfectly correct and still fail as a pair when they run in the wrong order. For library history, the structure had to exist before historical records could be inserted into it. A filename convention or human memory is not a strong enough production guarantee for that dependency.

Approach

I introduced distinct migration IDs and explicit ordering. The unordered schema and backfill variants were removed, and the migration runner used the set of already-applied IDs to determine what could run next. We also pinned the helper implementation used by the migration so the meaning of a previously executed migration could not change silently when shared code evolved later.

Outcome

The production migration path became deterministic, and the same release could no longer accidentally run the backfill before its schema. Migration history became an actual execution ledger rather than just a directory containing scripts.