Menu

Ten hand-written Room migrations and exportSchema = false: auditing an Android app's database history
📰

Ten hand-written Room migrations and exportSchema = false: auditing an Android app's database history

DEV Community: kotlin·ReClaim·1 day ago
#VljXuawH
#devtokotlin#devto#dev#migration#null
Reading 0:00
15s threshold

We're building ReClaim , a minimalist Android launcher that's on Google Play . Almost everything a user sets up in it lives in one Room database: Home favorites, folders, hidden apps and their unlock challenges, blocks, schedules, reminders, daily limits, website rules and the Home to-do list. That's 18 tables at schema version 14.

Every one of those versions after 4 has a hand-written migration, and the database is declared with exportSchema = false . That combination works until it doesn't, and when it doesn't, the user's whole setup is what breaks. This post is an audit of our own migration history: the rules we followed without writing them down, the safety net we removed on purpose, what turning off schema export cost us, and the small script we used to check ten migrations without a single migration test in the repo.

Stack: Kotlin, Jetpack Compose, Hilt, Room 2.6.1 with KSP, minSdk 26 , targetSdk 36 . Snippets are trimmed from the real code; // ... marks cuts.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.