PHPackages                             jamil/laravel-migration-guard - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. jamil/laravel-migration-guard

ActiveLibrary[Database &amp; ORM](/categories/database)

jamil/laravel-migration-guard
=============================

Detect dangerous Laravel migrations before running them in production

v0.1.0(1mo ago)21[2 issues](https://github.com/chowdhury-jamil-jc-787/laravel-migration-guard/issues)MITPHPPHP ^8.1 || ^8.2 || ^8.3

Since Apr 11Pushed 1mo agoCompare

[ Source](https://github.com/chowdhury-jamil-jc-787/laravel-migration-guard)[ Packagist](https://packagist.org/packages/jamil/laravel-migration-guard)[ RSS](/packages/jamil-laravel-migration-guard/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

🚨 Laravel Migration Guard
=========================

[](#-laravel-migration-guard)

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
-------------

[](#-quick-start)

```
composer require jamil/laravel-migration-guard
php artisan migrate:check
```

📸 Demo
------

[](#-demo)

[![Laravel Migration Guard Demo](assets/demo1.png)](assets/demo1.png)[![Laravel Migration Guard Demo](assets/demo2.png)](assets/demo2.png)
------------------------------------------------------------------------------------------------------------------------------------------

[](#)

⚠️ Why This Exists
------------------

[](#️-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
----------

[](#-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
------------------

[](#️-what-it-detects)

### 🔴 High Risk

[](#-high-risk)

- Dropping tables (data loss)
- Dropping columns (data loss)
- Changing column types (table lock risk)
- Raw SQL usage (manual review required)

### 🟡 Medium Risk

[](#-medium-risk)

- Adding indexes (performance impact)
- Adding unique indexes (duplicate data risk)

### 🧠 Smart Detection

[](#-smart-detection)

- NOT NULL columns without `nullable()`

---

📦 Installation
--------------

[](#-installation)

```
composer require jamil/laravel-migration-guard
```

---

🚀 Usage
-------

[](#-usage)

```
php artisan migrate:check
```

---

⚠️ Example Output
-----------------

[](#️-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
----------

[](#-ci-usage)

```
php artisan migrate:check --ci
```

- Exit code `1` if dangerous migrations detected
- Perfect for CI/CD pipelines

---

📊 JSON Output
-------------

[](#-json-output)

```
php artisan migrate:check --json
```

---

⚠️ Limitations
--------------

[](#️-limitations)

- Does not guarantee zero downtime
- Raw SQL requires manual review
- Some risks depend on table size and data volume

---

🛣 Roadmap
---------

[](#-roadmap)

- More migration rules
- PostgreSQL support
- Django version
- GitHub Action
- Configurable rules

---

🤝 Contributing
--------------

[](#-contributing)

PRs and ideas are welcome.

---

📄 License
---------

[](#-license)

MIT

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance68

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

59d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/81f09d721e48d851ab06fa59966264f6d701551d1e905b882cf7aa47e2e87580?d=identicon)[chowdhury-jamil-jc-787](/maintainers/chowdhury-jamil-jc-787)

---

Top Contributors

[![chowdhury-jamil-jc-787](https://avatars.githubusercontent.com/u/66878234?v=4)](https://github.com/chowdhury-jamil-jc-787 "chowdhury-jamil-jc-787 (7 commits)")

---

Tags

cicomposerdatabasedevopslaravelmigrationmysqlphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jamil-laravel-migration-guard/health.svg)

```
[![Health](https://phpackages.com/badges/jamil-laravel-migration-guard/health.svg)](https://phpackages.com/packages/jamil-laravel-migration-guard)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

3.0k54.1M11.0k](/packages/illuminate-database)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k29.9M42](/packages/kirschbaum-development-eloquent-power-joins)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8733.1M23](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.4M2](/packages/glushkovds-phpclickhouse-laravel)[lemaur/eloquent-publishing

207.8k1](/packages/lemaur-eloquent-publishing)[laravel-liberu/laravel-gedcom

A package that converts gedcom files to Eloquent models

782.5k1](/packages/laravel-liberu-laravel-gedcom)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
