generate_migration
Generate SQL migration scripts by comparing database schemas. Compare live databases or a database against target DDL to create ALTER statements for schema updates.
Instructions
Generate migration SQL by comparing two schemas.
Two modes of operation:
Mode 1 — Compare live database against target DDL:
connection_id: source database connection
target_sql: CREATE TABLE statements describing the desired schema
Mode 2 — Compare two live databases:
from_connection: source database connection_id
to_connection: target database connection_id
Returns dialect-aware ALTER statements to migrate source -> target. Destructive operations (DROP TABLE, DROP COLUMN) are commented out for safety.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection_id | No | ||
| target_sql | No | ||
| from_connection | No | ||
| to_connection | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |