作者 lyh

gx

... ... @@ -111,10 +111,9 @@ class Demo extends Command
$database_name = DB::connection('custom_tmp_mysql_copy')->getDatabaseName();
$tables = Schema::connection('custom_tmp_mysql_copy')->getAllTables();
$tables = array_column($tables, 'Tables_in_' . $database_name);
foreach ($tables as $table) {
config(['database.connections.custom_mysql.database' => 'gl_data_' . $news_project_id]);
$has_table = Schema::connection('custom_mysql')->hasTable($table);
if (!$has_table) {
$sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}");
DB::connection('custom_mysql')->statement(array_values((array)$sql[0])[0]); // 修正此处的sql语句获取方式
... ...