sql_migration_lint
Static lint of a SQL migration file (Postgres or MySQL) for operations that lock or rewrite live tables or break running application code. Flags CREATE INDEX without CONCURRENTLY and concurrent index builds inside a transaction, foreign key, CHECK and UNIQUE constraints added without NOT VALID or USING INDEX, SET NOT NULL without a validated CHECK, column type changes, NOT NULL columns added without a default, volatile or serial defaults that rewrite the table, dropped or renamed columns and tables, VACUUM FULL and CLUSTER, DELETE or UPDATE without WHERE, TRUNCATE, a missing lock_timeout, MySQL ALTERs without ALGORITHM/LOCK, and type advice (jsonb, text, identity, timestamptz). Tables created earlier in the same file are treated as new and skipped by lock and rewrite rules. The SQL is tokenized, never executed: no database is contacted, so table sizes and existing column types are unknown, and SQL inside strings, comments and function bodies is not linted. Up to 400 KB of SQL and 5,000 statements. Rules adapted from squawk and strong_migrations. Deterministic, no LLM.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sql": "<sql>"
},
"name": "sql_migration_lint"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | The migration file content. Max 400 KB (UTF-8); 512 KB request body. | |
| dialect | No | SQL dialect. "postgresql" and "pg" are also accepted, case-insensitive. | postgres |
| assume_large_tables | No | Treat existing tables as large and busy. false downgrades lock and rewrite errors (index without CONCURRENTLY, foreign key or unique without NOT VALID / USING INDEX, type change, SET NOT NULL, VACUUM FULL / CLUSTER) to warnings; data-loss and compatibility rules are never downgraded. |