Interview Prep/Real-World Interview/Data loss and corruption

A deploy ran a migration that dropped the `phone` column; old pods still running during the rolling update threw 500s, and a background job wrote nulls into a new table.

IntermediateTroubleshootingData loss and corruption
Answer

Likely causes → A destructive schema change shipped in the same release as the code that stopped using it. During a rollout old and new code run together, so the old version broke, and rollback is no longer possible because the column and its data are gone.

Diagnose → Check migration history (SELECT * FROM schema_migrations ORDER BY version DESC LIMIT 5; or Flyway/Liquibase history) and the error logs of old-version pods.

Fix → Finish or pause the rollout so only new code runs. Restore the column's data from a PITR copy into a side table if it's still needed.

Prevent → Expand and contract: add new things first, deploy code that no longer reads the old column, and drop it in a later release once nothing uses it. Lint migrations in CI to block DROP COLUMN / DROP TABLE without an explicit approval.

All Real-World Interview questions Roadmap: Interview readiness

More on Data loss and corruption