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