Skip to content

Migration Generator ‚Äč

The Migration Generator Command is a wrapper for Laravel's make:migration command, creating a new migration file for the specified module.

The command takes two arguments: the module name where the migration will be created, and the migration name.

To create a new create_products_table migration for the Product Module, you can run the following command:

bash
php artisan modular:make-migration Product create_products_table

Or if you are using Laravel Sail, run:

bash
sail artisan modular:make-migration Product create_products_table

A new migration file will be created in the modules/Product/Database/Migrations/ directory.

The purpose of this command is to serve as syntactic sugar, avoiding the need to type the full path to the custom migration directory (inside the module). For example:

bash
php artisan make:migration create_products_table --path=modules/Product/Database/Migrations