summaryrefslogtreecommitdiff
path: root/classes/db
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-04 09:43:12 +0300
committerAndrew Dolgov <[email protected]>2021-03-04 09:43:12 +0300
commit4ede76280b79ec02a5e1c05bf08bd87cf37c4334 (patch)
tree7dc24e9af353b4a13ce74418f40a1fc1cee1f16b /classes/db
parentbd4ade6329c9ee99023ce38e44b36ab42e413581 (diff)
migrations: don't try to use transactions on mysql
Diffstat (limited to 'classes/db')
-rw-r--r--classes/db/migrations.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/classes/db/migrations.php b/classes/db/migrations.php
index e5133ddf6..26866698b 100644
--- a/classes/db/migrations.php
+++ b/classes/db/migrations.php
@@ -82,7 +82,9 @@ class Db_Migrations {
else
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) {
Debug::log($line, Debug::LOG_EXTENDED);
@@ -99,7 +101,9 @@ class Db_Migrations {
else
$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);
} catch (PDOException $e) {