Handling Database Migrations in Android Apps
This article examines the migration strategies used in the ReClaim Android launcher, focusing on how new features and database changes are managed through Room migrations.

The ReClaim Android launcher uses a Room database to store user settings, including home favorites, hidden apps, and schedules. With 18 tables at schema version 14, the app relies on hand-written migrations for each version change after 4, and the database is declared with exportSchema = false. This approach ensures that user data remains intact during upgrades, but it also means that if a migration fails, the user's setup may break. All migrations are implemented as private objects within the Hilt module, and they follow a consistent pattern: adding new tables or new nullable columns to existing tables. For example, the migration from version 4 to 5 adds the per-app daily budgets table, while the migration from version 13 to 14 adds new columns to the hidden_apps table (source ID: 1). [1]
Every new column added to an existing table is declared as nullable, with null values representing default settings. This design avoids the need for default values in migration SQL, as the defaults are managed in Kotlin rather than in the database schema. For instance, the followSeconds, findRounds, and watchRounds columns in the hidden_apps table are nullable, and their default values are defined in Kotlin code. This approach ensures that existing rows in the database automatically inherit the new columns as null, which is interpreted as the default value. This strategy simplifies migration logic and reduces the risk of data inconsistencies (source ID: 1). [1]
The developers of ReClaim chose not to use the fallbackToDestructiveMigration() option, which would allow Room to recreate the database if a migration path is not found. Instead, the app crashes on open if a migration fails, ensuring that the user's data is not lost. This decision was made to avoid the risk of silently wiping user data, which could be particularly problematic for a launcher that helps users manage app usage. However, this choice also means that any version of the app older than version 4 will crash upon opening, as there is no migration path defined for those versions. This highlights the importance of carefully managing version history and ensuring that all migration paths are well-defined (source ID: 1). [1]
The ReClaim Android launcher stores user settings, such as home favorites, hidden apps, and schedules, in a Room database. Each new column added to an existing table is declared as nullable, with null values representing default settings. This approach allows the database to evolve without requiring data backfilling, as the absence of a value in a new column is interpreted as a default. Developers of ReClaim have opted not to use the fallbackToDestructiveMigration() option, which would allow Room to recreate the database if a migration path is not found. This decision is based on the belief that it is better to fail loudly, ensuring that any database migration issues are immediately apparent rather than silently wiping user data (Dev.to, 2023). [1]
Advertisement
Every new feature in ReClaim introduces a new table, while new options on existing features add new columns to existing tables. These migrations are implemented as private objects in the Hilt module that builds the database. For instance, a new feature may add a new table with specific columns, and new options on existing features may add new nullable columns to existing tables. This strategy ensures that migrations are well-defined and do not require data backfilling, as the absence of a value in a new column is interpreted as a default (Dev.to, 2023). [1]
The developers of ReClaim have chosen to keep the exportSchema flag set to false, which disables the automatic export of database schema files. This decision has implications for auto-migrations and migration testing, as both require exported schema files. Without these files, the developers have had to manually verify migrations using a custom Python script that compares the expected and actual database schemas. This approach has allowed them to ensure that migrations are correctly implemented, even without the use of auto-migrations or migration tests (Dev.to, 2023). [1]
Sources
Prepared with AI assistance from the cited sources.
The Cali Reporter newsletter
The stories worth your time.
California, the country, and what comes next. Join our free newsletter for reporting that keeps you informed.
More in Technology
- Modern Web Guidance 1.0 and Browser Compatibility
Modern Web Guidance 1.0, announced by Chrome for Developers on November 10, introduces browser compatibility data to assist coding agents in building web features. The initiative emphasizes the importance of fallback…
- Apache mod_http2 Vulnerability Detection with Nmap
A new Nmap scripting module has been developed to detect the Apache mod_http2 vulnerability (CVE-2026-119618), addressing the challenges of identifying affected systems accurately.
- Securing Remote Vendor Access in Industrial Networks
Best practices for managing remote vendor access in operational technology (OT) networks emphasize controlled access points, multifactor authentication, and time-bound sessions to reduce cybersecurity risks.
