正在显示
1 个修改的文件
包含
3 行增加
和
11 行删除
| @@ -75,16 +75,8 @@ class EditVideoMp4 extends Command | @@ -75,16 +75,8 @@ class EditVideoMp4 extends Command | ||
| 75 | $originalTableName = "gl_web_template"; | 75 | $originalTableName = "gl_web_template"; |
| 76 | $newTableName = "gl_web_template_copy"; | 76 | $newTableName = "gl_web_template_copy"; |
| 77 | // 检查原始表是否存在 | 77 | // 检查原始表是否存在 |
| 78 | - $result = DB::connection('custom_mysql')->query("SHOW TABLES LIKE '{$originalTableName}'"); | ||
| 79 | - if (count($result) == 1) { | ||
| 80 | - // 复制原始表结构到新表 | ||
| 81 | - DB::connection('custom_mysql')->query("CREATE TABLE {$newTableName} LIKE {$originalTableName}"); | ||
| 82 | - // 复制原始表数据到新表 | ||
| 83 | - DB::connection('custom_mysql')->query("INSERT INTO {$newTableName} SELECT * FROM {$originalTableName}"); | ||
| 84 | - echo "表复制成功!"; | ||
| 85 | - } else { | ||
| 86 | - echo "原始表不存在!"; | ||
| 87 | - } | ||
| 88 | - DB::connection('custom_mysql')->close(); | 78 | + DB::connection('custom_mysql')->select("SHOW TABLES LIKE '{$originalTableName}'"); |
| 79 | + DB::connection('custom_mysql')->statement("CREATE TABLE {$newTableName} LIKE {$originalTableName}"); | ||
| 80 | + DB::connection('custom_mysql')->statement("INSERT INTO {$newTableName} SELECT * FROM {$originalTableName}"); | ||
| 89 | } | 81 | } |
| 90 | } | 82 | } |
-
请 注册 或 登录 后发表评论