PHPackages                             idkwhoami/migration-rules - 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. idkwhoami/migration-rules

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

idkwhoami/migration-rules
=========================

Enforce consistent Laravel migration naming and ordering via topological sort, inlining, and regeneration.

0.1.0(1mo ago)03MITPHPPHP ^8.2

Since May 1Pushed 1mo agoCompare

[ Source](https://github.com/dev-idkwhoami/migration-rules)[ Packagist](https://packagist.org/packages/idkwhoami/migration-rules)[ RSS](/packages/idkwhoami-migration-rules/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Migration Rules
===============

[](#migration-rules)

A `composer require --dev` package that scans, sorts, inlines, and regenerates Laravel migrations to enforce consistent naming and ordering rules.

> **Warning:** Safe to run only on undeployed apps. This tool modifies your migration files.

Requirements
------------

[](#requirements)

- Laravel 12+ (anonymous class migration convention)
- PHP 8.2+

Installation
------------

[](#installation)

```
composer require idkwhoami/migration-rules --dev
```

Usage
-----

[](#usage)

```
# Preview what would change (no files written)
php artisan migrate:enforce --dry-run

# Apply changes
php artisan migrate:enforce

# Show current manifest / state
php artisan migrate:enforce --status
```

### Options

[](#options)

OptionDescriptionDefault`--dry-run`Preview changes without writing filesfalse`--pattern`Date prefix for filenames`0001_01_01``--base-step`Slot step for base migrations`50``--pivot-step`Slot step for pivot migrations`25``--force`Auto-resolve collisions (keep base version)false`--status`Show manifest statefalseRules
-----

[](#rules)

- **Filename pattern:** `{prefix}_{slot}_{action}.php`
- **Base slot step:** 50 (each distinct model)
- **Pivot slot step:** 25
- **Ordering:** Topological sort by FK dependencies
- **Altering migrations:** Inlined into base migration (no separate altering migrations)
- **down():** Omitted entirely (undeployed = no rollback needed)

FK Detection
------------

[](#fk-detection)

Detects foreign keys via:

- `->foreignId('column')->constrained()`
- `->foreignIdFor(Model::class)`
- `->foreignUlid('column')` / `->foreignUuid('column')`
- `->morphs('column')` / `->nullableMorphs()` / `->ulidMorphs()` / `->uuidMorphs()`
- `->constrained()->onDelete(...)`

External table references (tables outside `database/migrations/`) are skipped.

Manifest
--------

[](#manifest)

After running, a `.migration.rules` file is written to your project root and added to `.gitignore`. This allows subsequent runs to detect drift.

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance92

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

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

40d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/37446811?v=4)[idkwhoami](/maintainers/idkwhoami)[@Idkwhoami](https://github.com/Idkwhoami)

---

Top Contributors

[![dev-idkwhoami](https://avatars.githubusercontent.com/u/26493113?v=4)](https://github.com/dev-idkwhoami "dev-idkwhoami (1 commits)")

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/idkwhoami-migration-rules/health.svg)

```
[![Health](https://phpackages.com/badges/idkwhoami-migration-rules/health.svg)](https://phpackages.com/packages/idkwhoami-migration-rules)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

9782.1M153](/packages/laravel-ai)[illuminate/database

The Illuminate Database package.

3.0k54.1M11.0k](/packages/illuminate-database)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

210389.8k2](/packages/wnx-laravel-backup-restore)[illuminate/console

The Illuminate Console package.

13045.3M6.1k](/packages/illuminate-console)[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.2M18](/packages/bavix-laravel-wallet)[nativephp/desktop

NativePHP for Desktop

37833.6k8](/packages/nativephp-desktop)

PHPackages © 2026

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