locksmith

v0.1.1
io.github.cxk280/locksmith Checked 2 hours ago Published 5 months ago

Lints PostgreSQL migrations for dangerous locking operations and suggests safe rewrites.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

analyze_migration Analyze a SQL migration for locking hazards

Lint a PostgreSQL migration for operations that take dangerous locks (table rewrites, blocking index builds, validating constraints, destructive/breaking changes) and return a PASS/REVIEW/BLOCK verdict with per-statement findings and safe rewrites. Call this before applying or approving any migration.

ParameterTypeDescription
sql *stringThe full SQL migration script to analyze.
assumeLargeTablesbooleanAssume target tables are large/hot, so scans and rewrites are flagged. Default true (fail safe).

explain_lock Explain a PostgreSQL lock mode

Given a lock mode name (e.g. 'ACCESS EXCLUSIVE') or a fragment of an operation, explain what it blocks and which operations acquire it.

ParameterTypeDescription
query *stringA lock mode name or operation fragment, e.g. 'ACCESS EXCLUSIVE' or 'create index'.