room-migrations-at-scale

Installation
SKILL.md

Migrations once you have many versions

Migrations are a directed graph, not a ladder. Room walks it from the version on disk to the version in the code, and it can only walk edges you declared. A long-lived app has users on almost every version it ever shipped, so the starting points are the whole history.

Two kinds of edge exist and they cover different work:

  • Generated (autoMigrations = [AutoMigration(from = 23, to = 24)]) — produced at build time by diffing two exported schema files. Only expresses what a schema diff can express: added tables and columns, and — with a spec class — renames and deletions.
  • Hand-written (.addMigrations(object : Migration(5, 6) { … })) — anything that moves data.

Traps

The walker chains single steps — reachability needs every consecutive edge, and fan-in is an optimisation on top. The library composes an upgrade path out of the edges you declared, one hop at a time, so an unbroken chain of N → N+1 edges already carries every old version to the head. Fan-in edges onto each new target then shorten the walk for the common upgrades:

Installs
2
GitHub Stars
35
First Seen
6 days ago
room-migrations-at-scale — maxrave-dev/kotlin-footguns