Changes and migrations · stop 2 of 10

generate_migration

Writes the SQL to turn one schema into another.

Works in read modeTool sets: dba · full

You might ask

“Write a migration that brings public in line with staging.”

Your assistant may call generate_migration to answer.

How it works

  • Builds on schema_diff and returns SQL text. It never runs it, and destructive drops come out commented out so you decide on them.

Parameters

sourceSchemastringrequired
Name of the schema to migrate from, e.g. "public".
targetSchemastringrequired
Name of the schema to migrate towards, e.g. "staging".

What your assistant reads

The description nexql-mcp sends with the tool. It's how the assistant decides when to use it.

Emit migration SQL to evolve sourceSchema toward targetSchema (from a live schema_diff). Read-only — returns SQL text, never executes it. Destructive drops are commented out.