⚠️ WIP ⚠️ - Generate Laravel migration files from existing databases
MIT License
Generate Laravel migration files from existing databases.
composer require romanzipp/laravel-migration-generator
If you use Laravel 5.5+ you are already done, otherwise continue.
Add Service Provider to your app.php
configuration file:
romanzipp\MigrationGenerator\Providers\MigrationGeneratorProvider::class,
Copy configuration to config folder:
$ php artisan vendor:publish --provider="romanzipp\MigrationGenerator\Providers\MigrationGeneratorProvider"
php artisan mg:generate {--connection=}
You will see various new migration files prefixed with the current time & date.
Notice: This package can't guess the order in which migrations will be created. If you've created some foreign keys in your database, be sure to re-order the migration files based on these relations.
There are tests with the following matrix.
./vendor/bin/phpunit
Requires a running MySQL / MariaDB server
./vendor/bin/phpunit -c phpunit.mysql.xml
DB_HOST=127.0.0.1 DB_USERNAME=user DB_PASSWORD=secret ./vendor/bin/phpunit -c phpunit.mysql.xml
JSON
MySQL data type is not supported since Doctrine/DBAL interprets this as Doctrine\DBAL\Types\TextType