mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Only truncate users table if it exists
This commit is contained in:
@@ -298,6 +298,8 @@ class Upgrade39Users implements PreSchemaUpgradeInterface
|
|||||||
$connection = $em->getConnection();
|
$connection = $em->getConnection();
|
||||||
$dbPlatform = $connection->getDatabasePlatform();
|
$dbPlatform = $connection->getDatabasePlatform();
|
||||||
$connection->beginTransaction();
|
$connection->beginTransaction();
|
||||||
|
|
||||||
|
if ($connection->getSchemaManager()->tablesExist([ $meta->getTableName() ])) {
|
||||||
try {
|
try {
|
||||||
$connection->query('SET FOREIGN_KEY_CHECKS=0');
|
$connection->query('SET FOREIGN_KEY_CHECKS=0');
|
||||||
$connection->executeUpdate($dbPlatform->getTruncateTableSql($meta->getTableName()));
|
$connection->executeUpdate($dbPlatform->getTruncateTableSql($meta->getTableName()));
|
||||||
@@ -308,6 +310,7 @@ class Upgrade39Users implements PreSchemaUpgradeInterface
|
|||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the usr table has a nonce column or not.
|
* Check whether the usr table has a nonce column or not.
|
||||||
|
Reference in New Issue
Block a user