migrations: don't try to use transactions on mysql

This commit is contained in:
Andrew Dolgov 2021-03-04 09:43:12 +03:00
parent bd4ade6329
commit 4ede76280b
1 changed files with 6 additions and 2 deletions

View File

@ -82,7 +82,9 @@ class Db_Migrations {
else else
Debug::log("Starting migration to $version...", Debug::LOG_VERBOSE); Debug::log("Starting migration to $version...", Debug::LOG_VERBOSE);
$this->pdo->beginTransaction(); // mysql doesn't support transactions for DDL statements
if (Config::get(Config::DB_TYPE) != "mysql")
$this->pdo->beginTransaction();
foreach ($this->get_lines($version) as $line) { foreach ($this->get_lines($version) as $line) {
Debug::log($line, Debug::LOG_EXTENDED); Debug::log($line, Debug::LOG_EXTENDED);
@ -99,7 +101,9 @@ class Db_Migrations {
else else
$this->set_version($version); $this->set_version($version);
$this->pdo->commit(); if (Config::get(Config::DB_TYPE) != "mysql")
$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);
} catch (PDOException $e) { } catch (PDOException $e) {