作者 lyh

gx

... ... @@ -607,6 +607,8 @@ class ProjectLogic extends BaseLogic
$database_name = DB::connection('custom_tmp_mysql_copy')->getDatabaseName();
$table = Schema::connection('custom_tmp_mysql_copy')->getAllTables();
$table = array_column($table, 'Tables_in_' . $database_name);
var_dump($table);
die();
foreach ($table as $v) {
$has_table = Schema::connection('custom_mysql')->hasTable($v);
if ($has_table) {
... ... @@ -614,10 +616,10 @@ class ProjectLogic extends BaseLogic
}
$sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$v}");
DB::connection('custom_mysql')->statement(get_object_vars($sql[0])['Create Table']);
$tables = Schema::getConnection()->getDoctrineSchemaManager()->listTableNames();
foreach ($table as $v1) {
DB::connection('custom_mysql')->table($v1)->update(['project_id' => $news_project_id]);
}
// $tables = Schema::getConnection()->getDoctrineSchemaManager()->listTableNames();
// foreach ($table as $v1) {
// DB::connection('custom_mysql')->table($v1)->update(['project_id' => $news_project_id]);
// }
}
return true;
}
... ...