0

I want to change the default directory for creating migration i.e. If I do php artisan make:migration create_users_table, it should create users table in /database/migrations/child_database. I do not want to use --path every time I create a migration for child_database. I want to change the default directory for php artisan make:migration.

Engr. Umar Ejaz
  • 106
  • 1
  • 6

3 Answers3

0

you can create your own artisan command to achieve this:

create your a new artisan command and use it to make migration in your custom directory using this article. hope help you ^_^

zarin
  • 7
  • 3
0

try this package github repo or use laracast link

You can use loadMigrationsFrom() in your AppServiceProvider.

Inside the boot() function, run:


/**
 * Register Custom Migration Paths
 */
$this->loadMigrationsFrom([
    database_path().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR.'folder1',
    database_path().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR.'folder2',
]);/
Ramil Huseynov
  • 350
  • 4
  • 7
0

This question has been answered before, even though it's a little bit old it still has it's value. Have a look at: https://stackoverflow.com/a/35895106

If you use this answer, the default directory is changed and you will have the solution you want.

Erik Dohmen
  • 267
  • 1
  • 6