正在显示
1 个修改的文件
包含
5 行增加
和
5 行删除
| @@ -614,12 +614,12 @@ class ProjectLogic extends BaseLogic | @@ -614,12 +614,12 @@ class ProjectLogic extends BaseLogic | ||
| 614 | } | 614 | } |
| 615 | $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$v}"); | 615 | $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$v}"); |
| 616 | DB::connection('custom_mysql')->statement(get_object_vars($sql[0])['Create Table']); | 616 | DB::connection('custom_mysql')->statement(get_object_vars($sql[0])['Create Table']); |
| 617 | + // 执行同步数据的操作 | ||
| 618 | + DB::connection('custom_mysql')->insert("INSERT INTO {$v} SELECT * FROM custom_tmp_mysql_copy.{$v}"); | ||
| 619 | + | ||
| 620 | + if (Schema::connection('custom_mysql')->hasColumn($v, 'project_id')) { | ||
| 621 | + DB::connection('custom_mysql')->table($v)->update(['project_id' => $news_project_id]); | ||
| 617 | } | 622 | } |
| 618 | - foreach ($table as $v1) { | ||
| 619 | - if (!Schema::connection('custom_mysql')->hasColumn($v1, 'project_id')) { | ||
| 620 | - continue; // 如果表中不存在 project_id 列,则跳过这个表 | ||
| 621 | - } | ||
| 622 | - DB::connection('custom_mysql')->table($v1)->update(['project_id' => $news_project_id]); | ||
| 623 | } | 623 | } |
| 624 | return true; | 624 | return true; |
| 625 | } | 625 | } |
-
请 注册 或 登录 后发表评论