Menu

Room Migration v19: Adding a Unified Persons Directory Without Breaking Existing Data
📰

Room Migration v19: Adding a Unified Persons Directory Without Breaking Existing Data

DEV Community: database·DEVANSHU PATIL·11 days ago
#wTwC2IZV
#devtodatabase#devto#dev#table#migration
Long article (810 words) — no AI summary yet.
Reading 0:00
15s threshold

When an application grows organically, early data models inevitably hit structural limits.

In FinLedger's earliest releases, the lending subsystem was completely standalone. The lending_records SQLite table simply stored a raw text column: person_name TEXT NOT NULL . It worked well enough for logging simple loans to a few friends.

However, several sprints later, we designed the Split & Group Expenses Engine to allow roommates and friends to split dinner bills and vacation costs. The split engine also required contacts: people who participated in group expenses and owed shares of restaurant checks.

Suddenly, we had a serious architectural dilemma:

A user had "Rahul Patil" in their lending ledger with a Rs. 1,000 loan.

The same user had "Rahul" in their split expense ledger owing Rs. 450 for a pizza order.

Because contacts were stored as disconnected string fields in two separate tables, the application had no way of knowing that these two records belonged to the same human being.…

Continue reading — create a free account

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