I Let AI Handle My Database and Lost Everything

I messed up.

I was letting AI (Claude) handle implementation, and I didn’t take backups. My work just vanished.

The worst part? The “partially correct fixes” I’d made along the way were all gone too.

What Happened

Things got confusing midway through, so I decided to start over.

AI rolled back to a much older backup.

That was it. Everything I’d correctly fixed after that point — gone.

The Real Problem

Code was fine. I use Git, so I could trace the history and recover code changes quickly.

The problem was data.

I’d been letting AI modify the database directly. There was no record of what changed or how.

That’s the kind of thing that quietly kills you.

Why I Didn’t Set Up Backups

Sure, you could say “just sync DB backups with every Git commit.”

But here’s why I didn’t:

And fundamentally — backups preserve state, but not history.

That’s the real weakness.

What I Realized

When you let AI handle things:

A human would feel “this seems risky” and pause. AI has no fear. It just acts.

And situations like this — where AI deletes its own correct changes — happen naturally.

The Fix

One rule: manage all DB changes via SQL scripts.

Why This Works

The key insight: manage procedures, not state.

What I Did

I added rules to CLAUDE.md:

Make AI follow the rules too.

Takeaway

AI is capable, but it won’t manage your history for you.

Skip this, and you’ll silently lose hours.

The lesson: Always codify your data changes.