PHPackages                             laravel-auto/migrations - 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. laravel-auto/migrations

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

laravel-auto/migrations
=======================

Automatic Laravel model migrations.

1.2.0(3mo ago)02.2k—6.3%MITPHPPHP &gt;=8.1

Since Feb 15Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/chareka-legacy/laravel-auto-migrations)[ Packagist](https://packagist.org/packages/laravel-auto/migrations)[ RSS](/packages/laravel-auto-migrations/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (4)Versions (8)Used By (0)

Laravel Automatic Migrations
============================

[](#laravel-automatic-migrations)

Instead of having to create and manage migration files, this package allows you to specify your migrations inside your model classes via a `migration` method. When you run the `migrate:auto` command, it uses Doctrine to compare your model `migration` methods to the existing schema, and applies the changes automatically.

This package works fine alongside traditional Laravel migration files, for the cases where you still need migrations that are not coupled to a model. When you run the `migrate:auto` command, it will run your traditional migrations first, and the automatic migrations afterwards.

Documentation
-------------

[](#documentation)

- [Installation](#installation)
- [Usage](#usage)
- [Commands](#commands)
    - [Making Models](#making-models)
    - [Running Migrations](#running-migrations)
- [Migration Order](#migration-order)
- [Publishing Stubs](#publishing-stubs)

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

[](#installation)

Require the package via composer:

```
composer require laravel-auto/migrations
```

Usage
-----

[](#usage)

Declare a static `migration` method in your models:

```
namespace App\Models;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Eloquent\Model;

class MyModel extends Model
{
   public static function migration(Blueprint $table)
   {
       $table->id();
       $table->string('name');
       $table->timestamp('created_at')->nullable();
       $table->timestamp('updated_at')->nullable();
   }
}
```

Run the `migrate:auto` command:

```
php artisan migrate:auto
```

Commands
--------

[](#commands)

### Making Models

[](#making-models)

Make a model with a `migration` method included:

```
php artisan make:amodel {class} {--force} {--f|no-factory} {--s|no-soft-delete} {--m|no-static-migration}
```

This command will also make a factory whose `definition` points to the model method. Use `--force` to overwrite an existing model.

### Running Migrations

[](#running-migrations)

Run automatic migrations:

```
php artisan migrate:auto {--f|--fresh} {--s|--seed} {--force}
```

Use `-f` to wipe the database, `-s` to seed after migration, and `--force` to run migrations in production.

Migration Order
---------------

[](#migration-order)

You can specify the order to run your model migrations by adding a public `migrationOrder` property to your models. This is useful for pivot tables or situations where you must create a certain table before another.

```
class MyModel extends Model
{
    public $migrationOrder = 1;

    public function migration(Blueprint $table)
    {
        $table->id();
        $table->string('name');
        $table->timestamp('created_at')->nullable();
        $table->timestamp('updated_at')->nullable();
    }
}
```

The `migrate:auto` command will run the automatic migrations in the order specified. If no order is declared for a model, it will default to `0`. Thanks to [@vincentkedison](https://github.com/vincentkedison) for this idea.

Publishing Stubs
----------------

[](#publishing-stubs)

Use your own model and factory stubs by publishing package files:

```
php artisan vendor:publish --tag=laravel-automatic-migrations
```

Update the `stub_path` in `config/auto-migrate.php`:

```
'stub_path' => resource_path('stubs/vendor/laravel-automatic-migrations'),
```

Now edit the stub files inside `resources/stubs/vendor/laravel-automatic-migrations`. Commands will now use these stub files to make models and factories.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance79

Regular maintenance activity

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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

Every ~58 days

Recently: every ~84 days

Total

7

Last Release

108d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e270292643f0d9a467ac1010400d65143f8104b15eaafc4bdbb29d16efaa12d6?d=identicon)[joechark](/maintainers/joechark)

---

Top Contributors

[![jcharika](https://avatars.githubusercontent.com/u/42941541?v=4)](https://github.com/jcharika "jcharika (45 commits)")

### Embed Badge

![Health badge](/badges/laravel-auto-migrations/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-auto-migrations/health.svg)](https://phpackages.com/packages/laravel-auto-migrations)
```

###  Alternatives

[tpetry/laravel-postgresql-enhanced

Support for many missing PostgreSQL specific features

9982.0M14](/packages/tpetry-laravel-postgresql-enhanced)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58723.9M36](/packages/scienta-doctrine-json-functions)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11120.2M21](/packages/anourvalar-eloquent-serialize)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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