'How can I specify which database connection Laravel uses for the migration table?

I'm working on an app with multiple database connections. It seems when I run php artisan migrate:install it always creates the migrations table using my default connection in app/config/database.php, which is not ideal.

Is there a way to specify a different connection for the migrations table itself?



Solution 1:[1]

Edit: Looks like you want to change where the migrations table is stored. This I believe always uses the default. You can however specify where a table is supposed to be created as below:

You can specify a connection like so:

Schema::connection('foo')->create('users', function($table)
{
    $table->increments('id');
});

From http://laravel.com/docs/schema

Solution 2:[2]

In Laravel 5.5 this worked for me:

php artisan migrate --database=sqlite_testing

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nesl247
Solution 2 Nisal Gunawardana