muhammadhammadwaseem / db-mig-generator
Generate Laravel migrations from existing DB.
Package info
github.com/MuhammadHammadWaseem/db-mig-generator
pkg:composer/muhammadhammadwaseem/db-mig-generator
v2.0.0
2025-07-09 23:54 UTC
Requires
- doctrine/dbal: ^3.6
- illuminate/support: ^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
Suggests
- doctrine/dbal: Required only if you want to generate migration files from existing DB
README
Automatically generate Laravel migration files from an existing database schema — with built-in support for ENUM columns and zero manual setup.
🚀 Installation
composer require hammad123/laravel-db-migration-generator ✅ Compatible with Laravel 8, 9, and 10 ✅ Supports MySQL, MariaDB ✅ Automatically handles enum columns (converted to string()) ⚙️ Usage Run the Artisan command to generate migrations from your current database: php artisan hammad:migrate:generate 🔧 Options Option Description --connection= Use a specific DB connection from config/database.php --path= Output path for generated migrations 🧠 ENUM Support You don't need to manually map ENUM types — the package internally handles it. Example: status ENUM('active', 'inactive') DEFAULT 'active' Will be converted to: $table->string('status')->default('active'); 📁 Configuration (Optional) You can publish the config file to skip tables or customize paths: php artisan vendor:publish --tag=config This publishes: config/migration-generator.php Inside, you can: Skip specific tables Change default stub path Change default migration directory ✍️ Custom Stub You can publish and customize the stub used for migrations: php artisan vendor:publish --tag=stubs This gives you: resources/stubs/migration.stub You can edit the layout of the generated migration (e.g., indentation, formatting). ✅ Testing (For Contributors) This package uses Orchestra Testbench to test migrations in a real Laravel environment. Run tests: composer install --dev vendor/bin/phpunit 🤝 Contributing Pull requests and feature suggestions are welcome! If you find a bug or want a new feature, open an issue on GitHub. 📄 License MIT © Hammad 📦 Coming Soon (Optional Features) Column comments Foreign key support Relationships (HasMany, BelongsTo) Laravel 11 support.