PHPackages                             wmgbit/laravel-models-migration - 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. wmgbit/laravel-models-migration

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

wmgbit/laravel-models-migration
===============================

Put Laravel migration definitions inside models, and keep them synchronized with the database

v1.0.0(3y ago)041MITPHPPHP ^7.3|^8.0

Since May 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/wmgbit/laravel-models-migration)[ Packagist](https://packagist.org/packages/wmgbit/laravel-models-migration)[ RSS](/packages/wmgbit-laravel-models-migration/feed)WikiDiscussions main Synced yesterday

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

Laravel models migration
========================

[](#laravel-models-migration)

Put Laravel migration definitions inside models, and keep them synchronized with the database

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

[](#installation)

```
composer require wmgbit/laravel-models-migration
```

Inside the model class
----------------------

[](#inside-the-model-class)

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

class ModelExample extends Model
{

    function migration(Blueprint $table)
    {
        $table->id();
        $table->string('name');
        $table->string('email')->unique();
        $table->timestamp('email_verified_at')->nullable();
        $table->foreignId('user_id')->constrained();
        $table->unique(['name','user_id']);
        $table->rememberToken();
        $table->timestamps();
    }

}
```

Command
-------

[](#command)

Run the given command to run the laravel core migration script plus the definitions found in model classes againt the database

```
php artisan migrate:models
```

Limits
------

[](#limits)

The command will keep the columns data if their names are the same. However, there is no way implemented to rename a given column. So changing a column name will be simply a REMOVE plus ADD task for that given column. May be added in future release.

Execution order
---------------

[](#execution-order)

The command detects and handles the dependencies between models based on the definition of the foreign key constraints

Credit
------

[](#credit)

This package is a fork from [Laravel Automatic Migrations](https://github.com/bastinald/laravel-automatic-migrations/)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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

1451d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/58e91ee82d2ed92a2f5f5b440e460c035bc7828c4e97b5067a8b3f07acad4cb7?d=identicon)[wmgbit](/maintainers/wmgbit)

---

Tags

laravelmigrationdatabasesynchronizationmodels

### Embed Badge

![Health badge](/badges/wmgbit-laravel-models-migration/health.svg)

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

###  Alternatives

[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)[awssat/laravel-sync-migration

Laravel tool helps to sync migrations without refreshing the database

10923.2k](/packages/awssat-laravel-sync-migration)[daavelar/revengedb

RevengeDb provides an artisan command to make a reverse engineer of the database, generating automatically the migrations for you

193.1k](/packages/daavelar-revengedb)[codengine/laravel-custom-migrations

Custom Migrations for Laravel

131.3k](/packages/codengine-laravel-custom-migrations)

PHPackages © 2026

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