Creating data migrations for Laravel. This keeps data out of migrations and leaves it for schema changes only.
composer require lbadger/illuminate-data-migrations
Create a folder called "data_migrations" in the /database folder
'data-migrations' => 'data_migrations',
Add these to the 'providers' array
\Lbadger\Database\Providers\ArtisanServiceProvider::class,
\Lbadger\Database\Providers\DataMigrationServiceProvider::class,
$app['config']['database.data-migrations'] = 'data_migrations';
$app->register(\Lbadger\Database\Providers\ArtisanServiceProvider::class);
$app->register(\Lbadger\Database\Providers\DataMigrationServiceProvider::class);
If you would like to use custom stubs, you need to put your stub in the database/stubs directory with the suffix of .stub
- Note: You cannot have the same data migration class name as a normal migration