PHPackages                             oscarafdev/migrations-generator - 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. oscarafdev/migrations-generator

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

oscarafdev/migrations-generator
===============================

Generates Laravel Migrations from an existing database

12.0.1(5mo ago)362585.2k↓11.5%79[3 issues](https://github.com/oscarafdev/migrations-generator/issues)MITPHPPHP ^8.3

Since Feb 15Pushed 5mo ago9 watchersCompare

[ Source](https://github.com/oscarafdev/migrations-generator)[ Packagist](https://packagist.org/packages/oscarafdev/migrations-generator)[ RSS](/packages/oscarafdev-migrations-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (35)Used By (0)

Laravel Migrations Generator Laravel 5/6/7/8/9/10/11/12
=======================================================

[](#laravel-migrations-generator-laravel-56789101112)

[![Latest Stable Version](https://camo.githubusercontent.com/f8700f5f259d88d4d40e0df98412af33efd6c7f12bf5135d3cb08204171a02fe/68747470733a2f2f706f7365722e707567782e6f72672f6f7363617261666465762f6d6967726174696f6e732d67656e657261746f722f762f737461626c65)](https://packagist.org/packages/oscarafdev/migrations-generator)[![Monthly Downloads](https://camo.githubusercontent.com/5baca713c7c215690d79c392d8e6fb2c03ea8c9ac258c1bc6a3da3f8015af884/68747470733a2f2f706f7365722e707567782e6f72672f6f7363617261666465762f6d6967726174696f6e732d67656e657261746f722f642f6d6f6e74686c79)](//packagist.org/packages/oscarafdev/migrations-generator)[![License](https://camo.githubusercontent.com/ffa020df9a5814a8b31c287e0fbc70111d4f87f545726c5e816f733616dbd056/68747470733a2f2f706f7365722e707567782e6f72672f6f7363617261666465762f6d6967726174696f6e732d67656e657261746f722f6c6963656e7365)](https://packagist.org/packages/oscarafdev/migrations-generator)

Generate Laravel Migrations from an existing database, including indexes and foreign keys!

Versioning &amp; compatibility
==============================

[](#versioning--compatibility)

Branch / TagLaravel supportPHP supportNotes`laravel-12.x` (`12.0.0`)12.x&gt;= 8.3Install with `composer require oscarafdev/migrations-generator:^12.0`.`laravel-11.x` (`11.0.0`)11.x&gt;= 8.2Use `^11.0` for Laravel 11 apps.`laravel-10.x` (`10.0.0`)10.x&gt;= 8.1Use `^10.0` for Laravel 10 apps.`laravel-9.x` (`9.0.0`)9.x&gt;= 8.2Use `^9.0` to stay on the Laravel 9-compatible line.Legacy `2.x` (`2.0.24`)5.x – 8.x^5.6 || ^7.0 || ^8.0Last release for older apps (ships with the legacy generator dependency).Each Laravel major has its own maintenance branch/tag series (e.g. `laravel-12.x` -&gt; `12.y.z`). See `doc/versions.md` for the full compatibility matrix.

Contact
=======

[](#contact)

Laravel 6/7/8/9/10/11/12 installation
-------------------------------------

[](#laravel-6789101112-installation)

The recommended way to install this is through composer:

```
composer require oscarafdev/migrations-generator --dev
```

In Laravel 5.5+ the service providers will automatically get registered.

Usage
-----

[](#usage)

To generate migrations from a database, you need to have your database setup in Laravel's Config.

Run `php artisan migrate:generate` to create migrations for all the tables, or you can specify the tables you wish to generate using `php artisan migrate:generate table1,table2,table3,table4,table5`. You can also ignore tables with `--ignore="table3,table4,table5"`

Laravel Migrations Generator will first generate all the tables, columns and indexes, and afterwards setup all the foreign key constraints. So make sure you include all the tables listed in the foreign keys so that they are present when the foreign keys are created.

You can also specify the connection name if you are not using your default connection with `--connection="connection_name"`

Run `php artisan help migrate:generate` for a list of options.

Check out Chung Tran's blog post for a quick step by step introduction: [Generate Migrations from an existing database in Laravel 4](http://codingtip.blogspot.com/2014/04/laravel-4-generate-migration-existed-dabase-laravel-4.html)

Changelog
---------

[](#changelog)

Changelog for Laravel Migrations Generator

### Jan 2021: v2.0.24

[](#jan-2021-v2024)

- Support for Laravel 8
- Fixed a issue where double single quotes were generated

### Ago 2020: v2.0.23

[](#ago-2020-v2023)

- Added support for precisions in timestamp.
- Fixed an issue with the text type.
- Fixed other reported bugs

### May 2020: v2.0.19

[](#may-2020-v2019)

- Support for Laravel 7

Thank You
---------

[](#thank-you)

Thanks to Jeffrey Way for his amazing Laravel-4-Generators package. This package depends greatly on his work.

Contributors
------------

[](#contributors)

Bernhard Breytenbach ([@BBreyten](https://twitter.com/BBreyten))

Oscar Fernandez ([@oscarafdev](https://www.linkedin.com/in/oscarafdev/))

License
-------

[](#license)

The Laravel Migrations Generator is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

66

—

FairBetter than 99% of packages

Maintenance71

Regular maintenance activity

Popularity56

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~88 days

Recently: every ~0 days

Total

26

Last Release

161d ago

Major Versions

2.0.24 → 9.0.02025-12-07

9.0.0 → 10.0.02025-12-08

10.0.0 → 11.0.02025-12-08

11.0.0 → 12.0.02025-12-08

PHP version history (6 changes)v2.0.8PHP ^7.2

2.0.21PHP ^7.0

2.0.24PHP ^5.6 || ^7.0 || ^8.0

9.0.0PHP ^8.2

10.0.0PHP ^8.1

12.0.0PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![Xethron](https://avatars.githubusercontent.com/u/1497338?v=4)](https://github.com/Xethron "Xethron (76 commits)")[![oscarafdev](https://avatars.githubusercontent.com/u/57678138?v=4)](https://github.com/oscarafdev "oscarafdev (66 commits)")[![sanjaya-viper](https://avatars.githubusercontent.com/u/83057567?v=4)](https://github.com/sanjaya-viper "sanjaya-viper (7 commits)")[![tomzx](https://avatars.githubusercontent.com/u/188960?v=4)](https://github.com/tomzx "tomzx (5 commits)")[![shemgp](https://avatars.githubusercontent.com/u/1734126?v=4)](https://github.com/shemgp "shemgp (3 commits)")[![viral-vector](https://avatars.githubusercontent.com/u/20329865?v=4)](https://github.com/viral-vector "viral-vector (3 commits)")[![HelenCoilpillai](https://avatars.githubusercontent.com/u/83344985?v=4)](https://github.com/HelenCoilpillai "HelenCoilpillai (3 commits)")[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (2 commits)")[![pablorsk](https://avatars.githubusercontent.com/u/938894?v=4)](https://github.com/pablorsk "pablorsk (2 commits)")[![sebdesign](https://avatars.githubusercontent.com/u/667144?v=4)](https://github.com/sebdesign "sebdesign (2 commits)")[![ldebrouwer-rmn](https://avatars.githubusercontent.com/u/6084647?v=4)](https://github.com/ldebrouwer-rmn "ldebrouwer-rmn (2 commits)")[![cristianoteles](https://avatars.githubusercontent.com/u/215228?v=4)](https://github.com/cristianoteles "cristianoteles (2 commits)")[![akalongman](https://avatars.githubusercontent.com/u/423050?v=4)](https://github.com/akalongman "akalongman (2 commits)")[![spescina](https://avatars.githubusercontent.com/u/1956604?v=4)](https://github.com/spescina "spescina (1 commits)")[![tjventurini](https://avatars.githubusercontent.com/u/4708070?v=4)](https://github.com/tjventurini "tjventurini (1 commits)")[![Tucker-Eric](https://avatars.githubusercontent.com/u/6483755?v=4)](https://github.com/Tucker-Eric "Tucker-Eric (1 commits)")[![wilo-ahadi](https://avatars.githubusercontent.com/u/31555614?v=4)](https://github.com/wilo-ahadi "wilo-ahadi (1 commits)")[![peeto](https://avatars.githubusercontent.com/u/12824230?v=4)](https://github.com/peeto "peeto (1 commits)")[![AntiPaste](https://avatars.githubusercontent.com/u/4379220?v=4)](https://github.com/AntiPaste "AntiPaste (1 commits)")[![bktz](https://avatars.githubusercontent.com/u/1176448?v=4)](https://github.com/bktz "bktz (1 commits)")

---

Tags

laravelmigrationgeneratorartisanmigrations

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oscarafdev-migrations-generator/health.svg)

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

###  Alternatives

[kitloong/laravel-migrations-generator

Generates Laravel Migrations from an existing database

2.9k7.4M24](/packages/kitloong-laravel-migrations-generator)[xethron/migrations-generator

Generates Laravel Migrations from an existing database

3.3k3.3M25](/packages/xethron-migrations-generator)[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)[dragon-code/laravel-data-dumper

Adding data from certain tables when executing the `php artisan schema:dump` console command

3418.6k](/packages/dragon-code-laravel-data-dumper)

PHPackages © 2026

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