正在显示
1 个修改的文件
包含
6 行增加
和
4 行删除
| @@ -614,10 +614,12 @@ class ProjectLogic extends BaseLogic | @@ -614,10 +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 | -// $tables = Schema::getConnection()->getDoctrineSchemaManager()->listTableNames(); | ||
| 618 | -// foreach ($table as $v1) { | ||
| 619 | -// DB::connection('custom_mysql')->table($v1)->update(['project_id' => $news_project_id]); | ||
| 620 | -// } | 617 | + } |
| 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]); | ||
| 621 | } | 623 | } |
| 622 | return true; | 624 | return true; |
| 623 | } | 625 | } |
-
请 注册 或 登录 后发表评论