skip to Main Content

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.

3

Answers


  1. 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 ^_^

    Login or Signup to reply.
  2. 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',
    ]);/
    
    Login or Signup to reply.
  3. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search