In my app every user has its own database that created when user registered. Connection and database data (database name, username, password) are saved in a table in default
This is tedious to remember which migration corresponds to which database.
For Laravel 5.5 I used this approach:
public function up()
{
// this line is important
Illuminate\Support\Facades\DB::setDefaultConnection('anotherDatabaseConnection');
Schema::table('product',
function (Blueprint $table)
{
$table->string('public_id', 85)->nullable()->after('ProductID');
});
// this line is important, Probably you need to set this to 'mysql'
Illuminate\Support\Facades\DB::setDefaultConnection('nameOfYourDefaultDatabaseConnection');
}
All migrations can be run automatically without taking care of specifying database manually when running them.
Please note that migrations table is stored inside your default database.