jamil/laravel-migration-guard
Composer 安装命令:
composer require jamil/laravel-migration-guard
包简介
Detect dangerous Laravel migrations before running them in production
README 文档
README
Prevent dangerous database migrations before they break production.
Detect risky migrations like dropping tables, NOT NULL changes, raw SQL, and more — before deployment.
🚀 Quick Start
composer require jamil/laravel-migration-guard php artisan migrate:check
📸 Demo
⚠️ Why This Exists
Laravel migrations are powerful — but they can also break production:
- Table locks on large datasets
- Downtime during deployments
- Data loss from destructive operations
- Failed deployments due to unsafe schema changes
Laravel does not provide built-in safety checks.
This package helps you catch dangerous migrations before running them.
✨ Features
-
Scan pending migrations
-
Detect risky schema changes
-
Severity levels:
- HIGH
- MEDIUM
- LOW (coming soon)
-
Clear explanations of risks
-
Suggested safer approaches
-
CI support (
--ci) -
JSON output (
--json)
⚠️ What It Detects
🔴 High Risk
- Dropping tables (data loss)
- Dropping columns (data loss)
- Changing column types (table lock risk)
- Raw SQL usage (manual review required)
🟡 Medium Risk
- Adding indexes (performance impact)
- Adding unique indexes (duplicate data risk)
🧠 Smart Detection
- NOT NULL columns without
nullable()
📦 Installation
composer require jamil/laravel-migration-guard
🚀 Usage
php artisan migrate:check
⚠️ Example Output
Migration: 2026_04_10_drop_phone_from_users_table
[HIGH] Dropping column 'phone' may cause permanent data loss.
Summary:
High Risk: 1
🤖 CI Usage
php artisan migrate:check --ci
- Exit code
1if dangerous migrations detected - Perfect for CI/CD pipelines
📊 JSON Output
php artisan migrate:check --json
⚠️ Limitations
- Does not guarantee zero downtime
- Raw SQL requires manual review
- Some risks depend on table size and data volume
🛣 Roadmap
- More migration rules
- PostgreSQL support
- Django version
- GitHub Action
- Configurable rules
🤝 Contributing
PRs and ideas are welcome.
📄 License
MIT
jamil/laravel-migration-guard 适用场景与选型建议
jamil/laravel-migration-guard 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 2, 最近一次更新时间为 2026 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jamil/laravel-migration-guard 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jamil/laravel-migration-guard 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 36
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-11

