1- # laravel-migration-generator
1+ # Laravel Migration Generator
22
33[ ![ CI] ( https://github.com/N3XT0R/laravel-migration-generator/actions/workflows/ci.yml/badge.svg )] ( https://github.com/N3XT0R/laravel-migration-generator/actions/workflows/ci.yml )
44[ ![ Latest Stable Version] ( https://poser.pugx.org/n3xt0r/laravel-migration-generator/v/stable )] ( https://packagist.org/packages/n3xt0r/laravel-migration-generator )
55[ ![ Code Coverage] ( https://qlty.sh/badges/dafd3f82-6646-47ae-a73e-3007d27fd67d/test_coverage.svg )] ( https://qlty.sh/gh/N3XT0R/projects/laravel-migration-generator )
66[ ![ Maintainability] ( https://qlty.sh/badges/dafd3f82-6646-47ae-a73e-3007d27fd67d/maintainability.svg )] ( https://qlty.sh/gh/N3XT0R/projects/laravel-migration-generator )
77[ ![ License] ( https://poser.pugx.org/n3xt0r/laravel-migration-generator/license )] ( https://packagist.org/packages/n3xt0r/laravel-migration-generator )
88
9- # Laravel Migration Generator
9+ ## 📦 Overview
1010
1111** Laravel Migration Generator**
1212_ A powerful CLI tool to generate Laravel migration files from an existing MySQL database schema._
@@ -15,76 +15,134 @@ This tool provides a structured and extensible approach to reverse-engineering d
1515migration files. It supports foreign key constraints, correct dependency order, and customizable mapping logic –
1616enabling seamless integration into both legacy and modern Laravel projects (Laravel 7–12 supported).
1717
18+ ---
19+
1820## ✨ Features
1921
20- - ✅ Accurate detection of tables, columns, indexes, and foreign keys
21- - 🔄 Automatic sorting of migrations to preserve referential integrity
22- - 🧱 Modular architecture for custom export strategies
23- - 🧩 Compatible with Laravel 7–12 (EOL versions supported but no longer actively maintained)
24- - 🛠 Designed for maintainability, testability, and long-term project stability
22+ - ✅ Detects tables, columns, indexes, and foreign keys with precision
23+ - 🔄 Automatically orders migrations to maintain referential integrity
24+ - 🧱 Extensible design via modular definition/mapping architecture
25+ - 🧩 Supports Laravel 7 to 12 (EOL versions maintained in read-only mode)
26+ - 🛠 Clean, testable, and maintainable codebase
27+
28+ ---
2529
26- ## Version Compatibility
30+ ## 📊 Version Compatibility
2731
28- | Laravel/Lumen | PHP- Version | Migration- Generator | Is Supported? |
29- | ---------------| : -------------: | : -------------------: | --------------: |
30- | 5.x | 7.2 up to 7.4 | 1.0.10 | EOL |
31- | 6.x | 7.2 up to 7.4 | 1.0.10 | EOL |
32- | 7.x | 7.2 up to 8.0 | 2.0.0 | EOL |
33- | 8.x | 7.3 up to 8.0 | 3.0.0 | EOL |
34- | 9.x | 8.0 | 4.0.0 | EOL |
35- | 10.x | 8.1 to 8.3 | 5.0.0 | Yes |
36- | 11.x | 8.2 to 8.4 | 6.0.0 | Yes |
37- | 12.x | 8.2 to 8.4 | 7.0.0 | Yes |
32+ | Laravel/Lumen | PHP Version | Generator Version | Status |
33+ | ---------------| -------------| -------------------| -------------|
34+ | 5.x | 7.2 – 7.4 | 1.0.10 | ❌ EOL |
35+ | 6.x | 7.2 – 7.4 | 1.0.10 | ❌ EOL |
36+ | 7.x | 7.2 – 8.0 | 2.0.0 | ❌ EOL |
37+ | 8.x | 7.3 – 8.0 | 3.0.0 | ❌ EOL |
38+ | 9.x | 8.0 | 4.0.0 | ❌ EOL |
39+ | 10.x | 8.1 – 8.3 | 5.0.0 | ✅ Supported |
40+ | 11.x | 8.2 – 8.4 | 6.0.0 | ✅ Supported |
41+ | 12.x | 8.2 – 8.4 | 7.0.0 | ✅ Supported |
3842
39- ## Requirements
43+ > ⚠️ EOL versions are not actively developed but remain functional for legacy compatibility.
4044
41- - PHP 8.2
42- - Pdo_mysql extension
43- - MySQL 5.7 or higher
45+ ---
4446
45- ## Installation
47+ ## ⚙ Requirements
4648
47- You can install this package over composer via
49+ - PHP ≥ 8.2
50+ - ` pdo_mysql ` extension
51+ - MySQL ≥ 5.7
4852
49- ``bash
50- composer require n3xt0r/laravel-migration-generator
51- ``
53+ ---
5254
53- You`ll not need to add any ServiceProviders to your Configuration on Laravel,
54- this package will register itself on your project.
55+ ## 🧰 Installation
5556
56- When you are using Lumen, make sure you have added following line to your app.php :
57+ Install the package via Composer :
5758
58- ``
59+ ``` bash
60+ composer require n3xt0r/laravel-migration-generator --dev
61+ ```
62+
63+ Laravel will auto-discover the service provider. No manual registration is needed.
64+
65+ For ** Lumen** , register the service provider manually in ` bootstrap/app.php ` :
66+
67+ ``` php
5968$app->register(\N3XT0R\MigrationGenerator\Providers\MigrationGeneratorServiceProvider::class);
60- ``
69+ ```
70+
71+ ---
6172
62- ### Executing the Migrator from Artisan
73+ ## 🚀 Usage
6374
64- This Migrator can be executed over the command line by using following command :
75+ Run the migration generator via Artisan :
6576
66- ``
77+ ``` bash
6778php artisan migrate:regenerate
68- ``
79+ ```
80+
81+ This command will generate migration files from your existing MySQL schema into the ` database/migrations/ ` folder. The
82+ files will be ordered automatically to maintain referential integrity – no manual reordering required.
83+
84+ ---
85+
86+ ## ⚙️ Custom Export Strategy
87+
88+ If the default export does not meet your needs, the generator is fully extensible. You can override the export logic
89+ through Laravel's Dependency Injection container.
90+
91+ ### 🔧 Configuration
92+
93+ First, publish the configuration file:
94+
95+ ``` bash
96+ php artisan vendor:publish --tag=migration-generator-config
97+ ```
98+
99+ Edit ` config/migration-generator.php ` to adjust or override definitions and mappings.
100+
101+ ---
102+
103+ ## 🧩 Export Architecture
104+
105+ The export process is divided into two customizable layers:
106+
107+ ### Definition Classes
108+
109+ These classes extract schema information into a ** universal, internal representation** . This format is decoupled from
110+ Laravel and can be reused, extended, or mapped differently.
111+
112+ ### Mapping Classes
113+
114+ These classes transform the internal representation into ** valid Laravel migration code** (PHP). You can override them
115+ to adjust formatting, naming conventions, or structure.
116+
117+ ---
118+
119+ ## 🧪 Testing
120+
121+ To run the tests:
122+
123+ ``` bash
124+ ./vendor/bin/phpunit
125+ ```
126+
127+ Docker and CI pipelines are already integrated for continuous validation and quality assurance.
128+
129+ ---
69130
70- It will dump all your tables to the database/migrations folder in correct order.
71- So when you are using referential integrity it will write all migrations so that they could be
72- re-migrated without changing manually the order of the migration-files.
131+ ## 📄 License
73132
74- ### Custom Export
133+ This project is licensed under the [ MIT License ] ( LICENSE ) .
75134
76- Are you unhappy with the exported migrations? When you should need some customizations on it,
77- it would be possible to customize the export by extending the export-classes over the DI-Container.
135+ ---
78136
79- There is a Configuration file called "migration-generator", that you could publish and customize.
80- Every Export-Function like "exporting fields" or "exporting indexes" or else has a Definition- and a Mapping-Class.
137+ ## 🙌 Contributions
81138
82- #### Definition-Classes
139+ Contributions are welcome! Feel free to open issues or submit pull requests to improve the generator, add new database
140+ support (e.g., PostgreSQL), or enhance the customization layers.
83141
84- Definition-Classes are classes that define the internal runtime export-format.
85- They are used to generate the Schema-Results to a universal format, so that you or anyone else could extend it.
142+ ---
86143
87- #### Mapping-Classes
144+ ## 🔗 Links
88145
89- Mapping Classes are classes that converts internal universal format to executable php-code inside
90- the migration-classes.
146+ - 📦 [ Packagist Package] ( https://packagist.org/packages/n3xt0r/laravel-migration-generator )
147+ - 🧪 [ CI & Test Coverage] ( https://qlty.sh/gh/N3XT0R/projects/laravel-migration-generator )
148+ - 📘 [ Laravel Documentation] ( https://laravel.com/docs )
0 commit comments