Migration safety for Laravel + PostgreSQL

Flag statements that may lock a table before deployment.

DDLGate reads your migration files and flags supported statements that may block writes or take strong locks, then shows the safer pattern. Your agent can run it before each deploy.

15rules
1script
0dependencies
Historical capture under the former name (bundled unsafe example)
ERROR LS-02 examples/unsafe/2026_01_02_000001_raw_index.php:9 [orders]
  CREATE INDEX CONCURRENTLY inside the migration transaction fails.
  Fix: Set public $withinTransaction = false; on the migration class.
ERROR LS-03 examples/unsafe/2026_01_02_000001_raw_index.php:10 [orders]
  CREATE INDEX on 'orders' without CONCURRENTLY blocks writes.
  Fix: Use CREATE INDEX CONCURRENTLY and set public $withinTransaction = false;
WARN LS-13 examples/unsafe/2026_01_02_000001_raw_index.php:10
  This migration takes a strong lock but never sets lock_timeout.
  Fix: Run SET LOCAL lock_timeout = '5s' first so the migration fails fast instead of queueing.
ERROR LS-07 examples/unsafe/2026_01_02_000001_raw_index.php:11 [orders]
  SET NOT NULL on 'orders' scans the table under ACCESS EXCLUSIVE.
  Fix: ADD CONSTRAINT ... CHECK (col IS NOT NULL) NOT VALID; VALIDATE CONSTRAINT; then SET NOT NULL.
ddlgate: 1 file(s) scanned, 3 error(s), 1 warning(s)

Feel the problem in 2 minutes

Break nothing in production. Play Lock Watch: spot the migration lines that would lock a busy table.

Simulated training exercise, not a real scan result.

Open full page

Migration review at a glance

DDLGate is a single script that uses the Python 3 standard library. The skill tells your agent when to run it and how to read the result.

1

Write the migration

Your agent drafts or edits a Laravel migration or a plain PostgreSQL SQL file as usual.

2

Run the check

Run DDLGate on changed files. Findings include the rule, file and line, plus the table when identified.

3

Apply the safer pattern

Every finding carries a concrete fix, so the agent rewrites the statement and checks again.

One skill, the agents you already use

See vendors/README.md for documented setup by tool. Live installation and skill discovery are unverified.

Claude CodeCodexGemini CLIOpenCodeGitHub CopilotCursorAntigravity

Install

Install with skills CLI

npx skills add QidarSarhan/ddlgate

Follow the documented steps for your tool. Registry commands require a published repository. For Antigravity, copy the skill to .agents/skills/ddlgate/ or ~/.gemini/config/skills/ddlgate/.

/plugin marketplace add QidarSarhan/ddlgate
/plugin install ddlgate@ddlgate

Evidence, not promises

Example output

The terminal above is the real output on the bundled unsafe example.

Tests

The project includes unit tests that exercise rule behavior. See CI for unit test results.

PostgreSQL lock reference

The bundled PostgreSQL reference summarizes typical lock modes, what they can block, and version-specific behavior.

What it does not do

  • A clean run is not proof of zero downtime. It reads statements, not your live workload.
  • It does not connect to your database or run migrations.
  • The scan can miss dynamic table names, some call forms, and SQL stored in variables, loaded from external files, or built by joining strings.
  • Findings are advice with a reason; you decide what ships.
Get Involved

Join Our Community

Whether you are submitting pull requests, or helping others debug, your participation powers this project.