While working on one of my client projects, I was shocked to see as there were no migration files in a Laravel project. They provided me the live database to work with and it was somehow okay for now but we all know what migration files do in Laravel. It was itching me and I started researching for generating the migration files by using our existing database. Here comes to the rescue, one of the packages by Bennett Treptow was just what I was looking for. This is why I love OSS, you can find anything 😄

Installing the package

1
composer require --dev bennett-treptow/laravel-migration-generator

Usage

1
2
// Specifying the path for the laravel default migration path
php artisan generate:migrations --path=database/migrations

And that’s it. I got all the migration files for the project.