r/ClaudeCode • u/Adarsh_c_j • 7h ago
Built with Claude A backup restore is not an undo
Claude Code runs a bad migration at 2pm. Users keep signing up. You notice at 5pm.
A backup restore takes the whole database back to 1:59pm. Three hours of sign-ups are gone.
What you want is "undo that one change, keep everything else". So we built that into Backenly, an open-source Autonomous backend for applications made with coding agents.
What we built
- Undo works on one change, not the whole database
- Data written after the change is kept. If the undo would touch any of it, you see what before approving
- The undo is tested in a rolled-back transaction first
- Not everything can be undone yet (emptying a whole table, for example)
How Claude Code uses it
- It connects over MCP (npx u/backenly/mcp-server init)
- Schema changes it makes are recorded, each with its own ID
- If something breaks, it can ask to undo that change. Only you can approve it
- We also build Backenly with Claude Code
What we learned
- To a database, "rollback" means going back in time. After a bad agent change, people want "undo that one thing"
- An undo is a change too, so a person should approve it
How do you handle a bad migration today?
•
u/AutoModerator 7h ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/Warm_Cauliflower_207 6h ago
had a similar issue with a migration last year, our rollback wiped out 4 hours of user data. we ended up rebuilding the missing state from logs, but it was messy. wonder if backenly handles that kind of recovery too?
2
u/aaronsuns 5h ago
For the sign-ups lost after the bad change, a full restore doesn't have to be the only option. Restore point-in-time recovery (WAL in Postgres, binlog in MySQL) to a separate instance at the moment just before the migration, then copy back only the rows created or changed after that point. Wrap migrations in a transaction where the database supports transactional DDL, like Postgres, so a failed step rolls back cleanly. Keep the migration SQL in version control so you can check exactly which objects it touched.