← All work

Inherited system modernization

Finding the silent data loss in a platform I inherited

Brand kept confidential

The panel said “commission updated”; row-level security had silently rejected the write. It was the most valuable find of a five-month live migration.

5months with the system live while the database was replaced
2auth systems running in parallel through the cutover
23+controllers hardened against memory leaks

Problem

I took over a live restaurant discovery and booking platform (a Flutter app, an Express backend and a Next.js panel) from a previous team. My first commit was a crash fix; the real work was migrating a running system from MongoDB to Postgres.

Constraint

In inherited code you don't know which assumption is buried where. ObjectIds became UUIDs and the validation layer rejected the new ones with 400s; coordinates were converted to a POINT without validation. The migration had to run for five months without taking the system down.

Approach

The most valuable find was the least visible one: Supabase update() calls returned success even when row-level security silently rejected the write. The panel said “commission updated”; the database changed nothing. The fix was chaining .select() onto the update and treating a zero-row response as failure: small in code, not in consequence. I also kept two JWT systems alive at once and added cleanup to 23+ controllers to stop memory leaks.

Result

The system moved to its new database while staying live for five months, and the silent data loss was closed.

Inherited codebase (Mongo) → UUID + JSONB migration → update() → .select() chain → Zero rows = failure → Silent loss closed
PostgreSQLSupabaseMongoDBRow Level SecurityAuth / JWT

Need something like this?

Send two or three lines: what you have, what is broken or missing, and when you need it. I reply within 12 hours, Monday to Saturday.