@dominic60184
Dominik LubańskiDeveloper▲22
Full Stack & AI Developer, AIvanta
25m ago · Vibe-coding · Warsaw

AI Can Write Your Database Migration in Seconds. Rolling It Back Is Another Story.

One thing I'd be careful with when using coding agents on existing SaaS products is letting them make database changes without understanding the data already in production.

Adding a column is straightforward. Renaming one that's used by multiple services, background jobs, and older API clients is where things get interesting.

I've found it much safer to treat schema changes as a separate deployment step rather than letting an agent bundle everything into one commit.

For breaking changes, I'd usually go with an expand-and-contract approach: introduce the new schema, migrate data in batches, update consumers, and remove the old structure only after verifying nothing depends on it.

I'd also test migrations against a realistic dataset, not just an empty development database.
AI can generate perfectly valid SQL. That doesn't mean it's safe to execute against millions of existing records.

For teams shipping with Claude Code or Cursor, how are you reviewing AI-generated database migrations before production?

Comments

No comments yet
Start the conversation.
Log in to join the thread.