Skip to main content

Android Room Migration Test Matrix Generator

Generate Kotlin instrumentation-test code for every forward upgrade path between exported Android Room schema versions. room-migration-matrix reads Room schema JSON and an explicit migration graph, checks reachability, and writes a helper that runs those paths with Room's MigrationTestHelper.

Use it to keep migration-path coverage aligned with the schema versions your app ships. It complements Room's migration tools; it does not replace Room's migration engine.

Install and generate a matrix

Requires Python 3.10 or newer. Install from a checkout:

git clone https://github.com/buxerr/room-migration-matrix.git
cd room-migration-matrix
python -m pip install .
room-migration-matrix \
  --schemas app/schemas \
  --migrations migration-edges.json \
  --package com.example.db \
  --output app/src/androidTest/java/com/example/db/GeneratedMigrationMatrix.kt \
  --report build/migration-matrix.json

The migration manifest maps each version edge to the Kotlin expression for its migration object:

{
  "migrations": [
    { "from": 1, "to": 2, "symbol": "MIGRATION_1_2" },
    { "from": 2, "to": 3, "symbol": "AppMigrations.MIGRATION_2_3" },
    { "from": 1, "to": 3, "symbol": "MIGRATION_1_3" }
  ]
}

The generated Kotlin defines runGeneratedMigrationMatrix(migrationTestHelper). Call it from an Android instrumented test that owns a MigrationTestHelper. Add --migration-import for migration objects outside the generated file's package, and configure the helper to load the same exported schemas as the app.

What the matrix verifies

The generator finds a deterministic shortest route for each old-to-new version pair. A missing route fails generation instead of silently leaving that pair untested. Each generated path uses unique database names and Room's schema validation.

See the Room migration testing documentation for the underlying helper and migration APIs.

Scope and limitations

Schema validation does not prove that application data was preserved or transformed correctly. Add row-level assertions for important data changes. This tool generates forward paths only; downgrade testing requires a separate app policy.

Run the Python unit suite with PYTHONPATH=src python -m unittest discover -s tests -v.

License

MIT. See LICENSE.

Metadata

Release files for room-migration-matrix 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for room-migration-matrix 0.1.0
File Size Uploaded Provenance Actions
room_migration_matrix-0.1.0.tar.gz 7.6 kB With provenance Details for room_migration_matrix-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for room-migration-matrix 0.1.0
File Interpreter ABI Platform Actions
room_migration_matrix-0.1.0-py3-none-any.whl Python 3 none any Details for room_migration_matrix-0.1.0-py3-none-any.whl

Total release size: 15.1 kB

Release files / room_migration_matrix-0.1.0.tar.gz

Download URL room_migration_matrix-0.1.0.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ae01b6a569a379e645294afbcad0366c712adcb81517f87332694b4e9a46e577
BLAKE2b-256 checksum
How to use checksums
5814d53300fe6386600fa92255c9e01491d0a746c33f82bfbfb12f598b718e6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / room_migration_matrix-0.1.0-py3-none-any.whl

Download URL room_migration_matrix-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
383655871c6a0b23db076b9c748c31a169d7d1585bd2a754fe1c9a7685d58489
BLAKE2b-256 checksum
How to use checksums
c919f8633384674b7dbae0a93df9acdc12e74278b60c2807aca5b74f58175bdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for room-migration-matrix 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for room_migration_matrix-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page