|
...
|
...
|
@@ -75,16 +75,8 @@ class EditVideoMp4 extends Command |
|
|
|
$originalTableName = "gl_web_template";
|
|
|
|
$newTableName = "gl_web_template_copy";
|
|
|
|
// 检查原始表是否存在
|
|
|
|
$result = DB::connection('custom_mysql')->query("SHOW TABLES LIKE '{$originalTableName}'");
|
|
|
|
if (count($result) == 1) {
|
|
|
|
// 复制原始表结构到新表
|
|
|
|
DB::connection('custom_mysql')->query("CREATE TABLE {$newTableName} LIKE {$originalTableName}");
|
|
|
|
// 复制原始表数据到新表
|
|
|
|
DB::connection('custom_mysql')->query("INSERT INTO {$newTableName} SELECT * FROM {$originalTableName}");
|
|
|
|
echo "表复制成功!";
|
|
|
|
} else {
|
|
|
|
echo "原始表不存在!";
|
|
|
|
}
|
|
|
|
DB::connection('custom_mysql')->close();
|
|
|
|
DB::connection('custom_mysql')->select("SHOW TABLES LIKE '{$originalTableName}'");
|
|
|
|
DB::connection('custom_mysql')->statement("CREATE TABLE {$newTableName} LIKE {$originalTableName}");
|
|
|
|
DB::connection('custom_mysql')->statement("INSERT INTO {$newTableName} SELECT * FROM {$originalTableName}");
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|