Fixes for the db migration routine
parent
65a4dc7f18
commit
82fb01384f
|
|
@ -213,7 +213,9 @@ class MigrationRunner
|
|||
throw new MigrationException($migration, $migrationException->getMessage(), $migrationException);
|
||||
}
|
||||
}
|
||||
if ($this->pdo->inTransaction()) {
|
||||
$this->pdo->commit();
|
||||
}
|
||||
} catch (MigrationException $e) {
|
||||
if ($this->pdo->inTransaction()) {
|
||||
$this->pdo->rollBack();
|
||||
|
|
|
|||
|
|
@ -242,16 +242,21 @@ try {
|
|||
$all = array_unique(array_merge($pending, $applied));
|
||||
foreach ($all as $fname) {
|
||||
$path = realpath($migrationsDir . '/' . $fname);
|
||||
$content = false;
|
||||
if ($path && strpos($path, realpath($migrationsDir)) === 0) {
|
||||
$content = @file_get_contents($path);
|
||||
if ($content !== false) {
|
||||
$migration_contents[$fname] = $content;
|
||||
}
|
||||
}
|
||||
|
||||
$record = $runner->getMigrationRecord($fname);
|
||||
if ($record) {
|
||||
$migration_records[$fname] = $record;
|
||||
}
|
||||
|
||||
if ($content !== false && $content !== null) {
|
||||
$migration_contents[$fname] = $content;
|
||||
} elseif (!empty($record['content'])) {
|
||||
$migration_contents[$fname] = $record['content'];
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
// show error in the page
|
||||
|
|
|
|||
Loading…
Reference in New Issue