Difflock: Safer Laravel Migrations #61136
Unanswered
Heyosseus
asked this question in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Difflock - Safer Laravel Migrations
Hello everyone! I built Difflock because some of the most dangerous Laravel migrations are also completely valid Laravel code.
It passes review. It has a
down(). It works perfectly on your local database with four rows.Then production has 4.9 million.
The same applies to adding non-nullable columns to populated tables, changing column definitions, or introducing
cascadeOnDelete()where a simple delete can suddenly cascade through thousands of related records.Traditional CI often misses these problems because migrations are usually tested against empty databases.
That's what Difflock is for.
Difflock analyzes your migrations against the database and detects potentially dangerous changes such as:
It also provides:
difflock:migrateanalyzes pending migrations first, then hands control to Laravel's own migration system if they pass the configured safety threshold.Built for AI coding agents too
Difflock also ships with an MCP server and agent skills, allowing MCP-compatible coding agents to inspect real database context and lint migrations before they are applied.
An agent can check things like table structure, row counts, schema drift, and migration risks instead of blindly generating a migration and hoping CI catches it.
The intended workflow is:
Difflock is deliberately conservative. It doesn't modify the database it inspects and doesn't pretend to know things that depend on the database engine or version. When something is uncertain, it says so.
The goal is simple:
I'd love feedback from the Laravel community — especially what migration has caused you the most pain in production, and what you'd want an AI agent to check before changing your database.
GitHub: https://github.com/Heyosseus/difflock
Packagist: https://packagist.org/packages/heyosseus/difflock
All reactions