Skip to content

Commit

Permalink
Fix issue #47 on upgrade with MariaDB
Browse files Browse the repository at this point in the history
  • Loading branch information
srobotta committed Dec 16, 2024
1 parent dc370f0 commit 01b18ad
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ function add_instance_to_localized_string() {
global $DB;

// Category header.
$sql = sprintf('
UPDATE {%2$s} SET instanceid = {%1$s}.instanceid FROM {%1$s}
WHERE {%1$s}.id = {%2$s}.foreignkey AND {%2$s}.typeid = ?',
tables::INSTANCE_CATEGORY_TABLE,
tables::LOCALIZED_STRING_TABLE,
);
$DB->execute($sql, [
$sql = $DB->get_dbfamily() === 'postgres'
? 'UPDATE {%2$s} SET instanceid = {%1$s}.instanceid FROM {%1$s}
WHERE {%1$s}.id = {%2$s}.foreignkey AND {%2$s}.typeid = ?'
: 'UPDATE {%2$s} JOIN {%1$s} ON {%1$s}.id = {%2$s}.foreignkey
SET {%2$s}.instanceid = {%1$s}.instanceid
WHERE {%2$s}.typeid = ?';
$DB->execute(sprintf($sql, tables::INSTANCE_CATEGORY_TABLE, tables::LOCALIZED_STRING_TABLE), [
localized_string_type::str2id(localized_string_type::INSTANCE_CATEGORY_HEADER),
]);

Expand Down

0 comments on commit 01b18ad

Please sign in to comment.