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();
});
}
question from:
https://stackoverflow.com/questions/65661821/laravel-7-problem-when-save-migration-log-in-migrations-table 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…