[DATABASE] Update "modified" in Managed_DataObject instead of a DBMS trigger

Instead of relying on the MariaDB's ON UPDATE CURRENT_TIMESTAMP trigger update
"modified" attributes in Managed_DataObject. Every raw query that needs
adjusting is adjusted, as they won't update "modified" automatically anymore.

The main goal behind this change is to fix "modified" updates on PostgreSQL.
This commit is contained in:
Alexei Sorokin
2020-07-27 19:10:33 +03:00
parent 341f3d0ea5
commit ec86de2bc4
17 changed files with 224 additions and 140 deletions

View File

@@ -89,10 +89,14 @@ class ClearflagAction extends ProfileFormAction
{
$ufp = new User_flag_profile();
$result = $ufp->query('UPDATE user_flag_profile ' .
'SET cleared = CURRENT_TIMESTAMP ' .
'WHERE cleared IS NULL ' .
'AND profile_id = ' . $this->profile->id);
$result = $ufp->query(sprintf(
<<<'END'
UPDATE user_flag_profile
SET cleared = CURRENT_TIMESTAMP, modified = cleared
WHERE cleared IS NULL AND profile_id = %d
END,
$this->profile->getID()
));
if ($result === false) {
// TRANS: Server exception given when flags could not be cleared.