正在显示
1 个修改的文件
包含
2 行增加
和
1 行删除
| @@ -102,6 +102,8 @@ class Demo extends Command | @@ -102,6 +102,8 @@ class Demo extends Command | ||
| 102 | // } | 102 | // } |
| 103 | 103 | ||
| 104 | public function handle(){ | 104 | public function handle(){ |
| 105 | + //切换数据库配置 | ||
| 106 | + ProjectServer::useProject(1862); | ||
| 105 | return $this->initTable(1380,1862); | 107 | return $this->initTable(1380,1862); |
| 106 | } | 108 | } |
| 107 | 109 | ||
| @@ -112,7 +114,6 @@ class Demo extends Command | @@ -112,7 +114,6 @@ class Demo extends Command | ||
| 112 | $tables = Schema::connection('custom_tmp_mysql_copy')->getAllTables(); | 114 | $tables = Schema::connection('custom_tmp_mysql_copy')->getAllTables(); |
| 113 | $tables = array_column($tables, 'Tables_in_' . $database_name); | 115 | $tables = array_column($tables, 'Tables_in_' . $database_name); |
| 114 | foreach ($tables as $table) { | 116 | 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); | 117 | $has_table = Schema::connection('custom_mysql')->hasTable($table); |
| 117 | if (!$has_table) { | 118 | if (!$has_table) { |
| 118 | $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}"); | 119 | $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}"); |
-
请 注册 或 登录 后发表评论