room-migrations

Designs and applies Room database migrations with schema versioning and data-preservation tests.

Updated May 9, 2026
One-click install
npx skills add https://github.com/Bumh3rr/solvyx-app --skill room-migrations-bumh3rr
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: room-migrations
Source: https://github.com/Bumh3rr/solvyx-app/tree/main/.opencode/skill/room-migrations
Command: npx skills add https://github.com/Bumh3rr/solvyx-app --skill room-migrations-bumh3rr

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Changing an Android Room database schema without a proper migration risks destroying user data or crashing the app on upgrade. This Skill provides the rules, templates, and testing practices to evolve the Solvyx database schema safely across versions. ## Core Features & Use Cases - Migration Templates: Ready-to-use Kotlin patterns for additive changes, table renames, and full data-copy migrations using Migration classes and SupportSQLiteDatabase. - Versioning Rules: A decision table defining when to bump @Database version and how to register migrations in AppDatabase.MIGRATIONS without fallbackToDestructiveMigration. - Migration Testing: AndroidX MigrationTestHelper test patterns plus schema JSON export via KSP to validate that upgrades preserve existing user data. - Use Case: When adding a suenoHoras column to the bitacora_entries table, follow the additive migration template, register MIGRATION_4_5, export the schema, and write a test proving existing rows survive the upgrade. ## Quick Start Ask the assistant to write a Room migration from version 4 to 5 that adds a nullable column to an existing table, including the migration test and schema export setup.

Frequently Asked Questions about room-migrations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a Room database migration in Android?▼

Create a Migration object with start and end versions, execute SQL via SupportSQLiteDatabase such as ALTER TABLE ADD COLUMN, then register it in the database builder with addMigrations. Always bump the @Database version and add a migration test.

How do I test Room migrations before releasing?▼

Use AndroidX MigrationTestHelper to create the database at the old version, insert sample rows, then run runMigrationsAndValidate to the new version and assert the data survived. Export schema JSON via the KSP room.schemaLocation argument so the helper can validate.

When is fallbackToDestructiveMigration acceptable in Room?▼

Only with documented justification: an incompatible major model redesign, an early beta with non-production data, or after explicit user consent with a backup offered. Using it silently in production destroys user history and is prohibited.

How do I rename or change a column type in Room without losing data?▼

Use ALTER TABLE ... RENAME COLUMN for renames. For type changes, create a new table with the target schema, copy rows with INSERT INTO ... SELECT, drop the old table, rename the new one, and recreate indexes.

Why does my Room migration fail validation after upgrade?▼

Validation fails when the migrated schema does not match the exported schema JSON, often due to missing indexes, wrong column nullability, or uncommitted schema files. Compare the exported JSON for both versions and recreate indexes explicitly in the migration.