mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG FIx manual resetDBSchema() calls breaking the database
This commit is contained in:
parent
f2c2ded27f
commit
a116b5dad8
@ -105,7 +105,8 @@ class TempDatabase
|
||||
*
|
||||
* @return bool True if successfully rolled back, false otherwise. On error the DB is
|
||||
* killed and must be re-created. Note that calling rollbackTransaction() when there
|
||||
* is no transaction is counted as a failure, and will kill the DB.
|
||||
* is no transaction is counted as a failure, user code should either kill or flush the DB
|
||||
* as necessary
|
||||
*/
|
||||
public function rollbackTransaction()
|
||||
{
|
||||
@ -120,9 +121,6 @@ class TempDatabase
|
||||
$success = false;
|
||||
}
|
||||
}
|
||||
if (!$success) {
|
||||
static::kill();
|
||||
}
|
||||
return $success;
|
||||
}
|
||||
|
||||
@ -247,7 +245,12 @@ class TempDatabase
|
||||
// pgsql doesn't allow schema updates inside transactions
|
||||
// so we need to rollback any transactions before commencing a schema reset
|
||||
if ($this->hasStarted()) {
|
||||
$this->rollbackTransaction();
|
||||
// Sometimes transactions fail, rebuild
|
||||
$success = $this->rollbackTransaction();
|
||||
if (!$success) {
|
||||
$this->kill();
|
||||
$this->build();
|
||||
}
|
||||
}
|
||||
if (!$this->isUsed()) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user