Download the PHP package marcelohoffmeister/migrator without Composer
On this page you can find all versions of the php package marcelohoffmeister/migrator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marcelohoffmeister/migrator
More information about marcelohoffmeister/migrator
Files in marcelohoffmeister/migrator
Package migrator
Short Description Namespaced Migrations for Laravel 6.0+
License MIT
Informations about the package migrator
marcelohoffmeister/migrator
This package is a customized version of Laravel's default database migrator, it was designed to register migrations on services providers and support namespacing as well.
There is no timestamp previews since the run order is based on how you register the migrations.
Warning
This Package Supports Laravel starting on 5.2 up to the latest stable version.
Installing
In order to install Migrator, run the following command into your Laravel 6.0+ project:
After installing the Package, you can now register it's provider into your config/app.php file:
And publish configuration: with
Usage
As the default Laravel migrator, this one has all the original commands, to list the available options, you can see all the available options using php artisan
command.
Creating Migrations
In order to generate an empty migration, please provide the migrator with the full qualified class name, as the example.
php artisan migrator:make 'MyApp\MyModule\Database\Migrations\CreateOrdersTable' --create=orders
This will create a migration class into the right directory, the resulting file is slightly different from the default Laravel generated:
To declare your table fields, just follow the usual schema build practices, this package don't make anything different there.
As the normal migrator, you can pass the option --table
instead of --create
in order to generate a update migration instead of a create one. Also, you can create a empty migration not passing any of those options.
In this fork, you can pass the option --path for the fresh command. This execute the command in the specific path.
Registering migrations.
Inside any service provider of your choice (usually on the same namespace that you're storing the migrations), you easily register the migrations using the Migrator\MigratorTrait
: