正在显示
1 个修改的文件
包含
1 行增加
和
2 行删除
| @@ -111,10 +111,9 @@ class Demo extends Command | @@ -111,10 +111,9 @@ class Demo extends Command | ||
| 111 | $database_name = DB::connection('custom_tmp_mysql_copy')->getDatabaseName(); | 111 | $database_name = DB::connection('custom_tmp_mysql_copy')->getDatabaseName(); |
| 112 | $tables = Schema::connection('custom_tmp_mysql_copy')->getAllTables(); | 112 | $tables = Schema::connection('custom_tmp_mysql_copy')->getAllTables(); |
| 113 | $tables = array_column($tables, 'Tables_in_' . $database_name); | 113 | $tables = array_column($tables, 'Tables_in_' . $database_name); |
| 114 | - | ||
| 115 | foreach ($tables as $table) { | 114 | foreach ($tables as $table) { |
| 115 | + config(['database.connections.custom_mysql.database' => 'gl_data_' . $news_project_id]); | ||
| 116 | $has_table = Schema::connection('custom_mysql')->hasTable($table); | 116 | $has_table = Schema::connection('custom_mysql')->hasTable($table); |
| 117 | - | ||
| 118 | if (!$has_table) { | 117 | if (!$has_table) { |
| 119 | $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}"); | 118 | $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}"); |
| 120 | DB::connection('custom_mysql')->statement(array_values((array)$sql[0])[0]); // 修正此处的sql语句获取方式 | 119 | DB::connection('custom_mysql')->statement(array_values((array)$sql[0])[0]); // 修正此处的sql语句获取方式 |
-
请 注册 或 登录 后发表评论