mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Fixed issue, that users table were delete while PartKeepr import on certain databases
This fixes issue #299
This commit is contained in:
parent
44cb0fa434
commit
ab11747fab
2 changed files with 7 additions and 2 deletions
|
@ -176,6 +176,11 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface
|
|||
continue;
|
||||
}
|
||||
|
||||
// The table name might be quoted, we have to trim it
|
||||
// See https://github.com/Part-DB/Part-DB-server/issues/299
|
||||
$tbl = trim($tbl, '"');
|
||||
$tbl = trim($tbl, '`');
|
||||
|
||||
// If the table is excluded, skip it as well
|
||||
if (in_array($tbl, $this->excluded, true)) {
|
||||
continue;
|
||||
|
|
|
@ -43,8 +43,8 @@ class PKImportHelper
|
|||
*/
|
||||
public function purgeDatabaseForImport(): void
|
||||
{
|
||||
//Versions with "" are needed !!
|
||||
$purger = new ResetAutoIncrementORMPurger($this->em, ['users', '"users"', 'groups', '"groups"', 'u2f_keys', 'internal', 'migration_versions']);
|
||||
//We use the ResetAutoIncrementORMPurger to reset the auto increment values of the tables. Also it normalizes table names before checking for exclusion.
|
||||
$purger = new ResetAutoIncrementORMPurger($this->em, ['users', 'groups', 'u2f_keys', 'internal', 'migration_versions']);
|
||||
$purger->purge();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue