|
|
@ -82,11 +82,14 @@ class Db_Migrations {
|
|
|
|
else
|
|
|
|
else
|
|
|
|
Debug::log("Starting migration to $version...", Debug::LOG_VERBOSE);
|
|
|
|
Debug::log("Starting migration to $version...", Debug::LOG_VERBOSE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$lines = $this->get_lines($version);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (count($lines) > 0) {
|
|
|
|
// mysql doesn't support transactions for DDL statements
|
|
|
|
// mysql doesn't support transactions for DDL statements
|
|
|
|
if (Config::get(Config::DB_TYPE) != "mysql")
|
|
|
|
if (Config::get(Config::DB_TYPE) != "mysql")
|
|
|
|
$this->pdo->beginTransaction();
|
|
|
|
$this->pdo->beginTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($this->get_lines($version) as $line) {
|
|
|
|
foreach ($lines as $line) {
|
|
|
|
Debug::log($line, Debug::LOG_EXTENDED);
|
|
|
|
Debug::log($line, Debug::LOG_EXTENDED);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
$this->pdo->query($line);
|
|
|
|
$this->pdo->query($line);
|
|
|
@ -105,6 +108,9 @@ class Db_Migrations {
|
|
|
|
$this->pdo->commit();
|
|
|
|
$this->pdo->commit();
|
|
|
|
|
|
|
|
|
|
|
|
Debug::log("Migration finished, current version: " . $this->get_version(), Debug::LOG_VERBOSE);
|
|
|
|
Debug::log("Migration finished, current version: " . $this->get_version(), Debug::LOG_VERBOSE);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Debug::log("Migration failed: schema file is empty or missing.", Debug::LOG_VERBOSE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} catch (PDOException $e) {
|
|
|
|
} catch (PDOException $e) {
|
|
|
|
Debug::log("Migration failed: " . $e->getMessage(), Debug::LOG_VERBOSE);
|
|
|
|
Debug::log("Migration failed: " . $e->getMessage(), Debug::LOG_VERBOSE);
|
|
|
|