I have multiple database connection and have a master database that others database connect to this. The problem is I want run a migration in once and only the last database save this migration batch into the table.
How to make all database save this migration batch record into the migrations table? Please give some advice, thanks and appreciate.
$copies= DB::connection('mysql_master')->table('copies')->where('status', '1')->get();
forEach($copiesas $c){
Config::set('database.connections.mysql', [
'driver'=>'mysql',
'host'=> $c->dbserver,
'database'=>$c->dbname,
'username'=>$c->dbuser,
'password'=>$c->dbpassword
]);
DB::purge('mysql');
Schema::table('users', function (Blueprint $table) {
$table->string('source')->nullable();
});
}