Skip to content

Commit

Permalink
fix: double inserting to mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
WatheqAlshowaiter committed Aug 20, 2024
1 parent 5620b17 commit e4ee7a3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/BackupTablesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ protected function processBackup(array $tablesToBackup = [])
default:
throw Exception('NOT SUPPORTED DATABASE DRIVER');
}

Schema::enableForeignKeyConstraints();

}
Expand Down Expand Up @@ -123,10 +122,8 @@ protected function backupTablesForSqlite($newTableName, $table)

protected function backupTablesForForMysqlAndMariaDb($newTableName, $table): array
{
if ($this->getMysqlVersion() >= Constants::VERSION_AFTER_STORED_AS_VIRTUAL_AS_SUPPORT) {
DB::statement(/**@lang MySQL**/ "CREATE TABLE $newTableName AS SELECT * FROM $table");
DB::statement(/**@lang MySQL**/ "INSERT INTO $newTableName SELECT * FROM $table");
}
DB::statement(/**@lang MySQL**/ "CREATE TABLE $newTableName AS SELECT * FROM $table");
//DB::statement(/**@lang MySQL**/ "INSERT INTO $newTableName SELECT * FROM $table");

$newCreatedTables[] = $newTableName;
$response[] = " Table '$table' cloned successfully.";
Expand Down

0 comments on commit e4ee7a3

Please sign in to comment.