Skip to content

Commit 5b59bb3

Browse files
WIP: return test_generate_multiple_table_backup back
1 parent a604f2f commit 5b59bb3

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

src/BackupTablesService.php

-25
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ protected function backupTablesForForMysql($newTableName, $table): array
115115

116116
// for MySQL 5.7
117117

118-
119-
120118
DB::statement("Create TABLE IF Not exists $newTableName like $table");
121119

122120
$columns = collect(DB::select("SHOW COLUMNS FROM $table"))
@@ -128,29 +126,6 @@ protected function backupTablesForForMysql($newTableName, $table): array
128126
DB::statement(/**@lang MySQL */ "INSERT INTO $newTableName ($columns) SELECT $columns FROM $table");
129127

130128

131-
// Step 1: Create the new table with the same structure, including generated columns
132-
//DB::statement(/**@lang MySQL */ "CREATE TABLE $newTableName LIKE $table");
133-
134-
// Step 2: get the definition for generated columns `SHOW CREATE TABLE $table`
135-
// Step 3: extract the virtual columns definition to alter them later
136-
// Step 4: get all non-generated columns, then insert them to the new table
137-
// Step 5: Alter new table to add the generated tables definitions.
138-
139-
140-
//$generatedColumns = collect(DB::select(DB::raw('SHOW COLUMNS FROM $table')))
141-
//;
142-
143-
// Step 2: Get the list of columns, excluding generated columns
144-
//$columns = collect(DB::select(DB::raw("SHOW COLUMNS FROM $table")))
145-
// ->reject(function ($column) {
146-
// return str_contains($column->Extra, 'VIRTUAL GENERATED') || str_contains($column->Extra, 'STORED GENERATED');
147-
// })->pluck('Field')
148-
// ->implode(', ');
149-
150-
// Step 3: Insert data into the new table, excluding generated columns
151-
//DB::statement(/**@lang MySQL */ "INSERT INTO $newTableName ($columns) SELECT $columns FROM $table");
152-
153-
//DB::statement(/**@lang PostgreSQL */ "CREATE TABLE $newTableName AS SELECT * FROM $table"); // todo for now
154129
return $this->returnedBackupResponse($newTableName, $table);
155130
}
156131

0 commit comments

Comments
 (0)