From 979a441f943574eba955871b8382d318ff97d214 Mon Sep 17 00:00:00 2001 From: Christian Hartmann Date: Wed, 15 Jan 2025 19:00:36 +0100 Subject: [PATCH] fix: subtraction in access_enum Signed-off-by: Christian Hartmann --- lib/Migration/Version050000Date20241005173955.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Migration/Version050000Date20241005173955.php b/lib/Migration/Version050000Date20241005173955.php index d93ee3ead..5133b760c 100644 --- a/lib/Migration/Version050000Date20241005173955.php +++ b/lib/Migration/Version050000Date20241005173955.php @@ -11,6 +11,7 @@ use Closure; use OCP\DB\ISchemaWrapper; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -31,8 +32,11 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $qbUpdate = $this->db->getQueryBuilder(); $qbUpdate->update('forms_v2_forms') - ->set('access_enum', 'access_enum - 3') - ->where($qbUpdate->expr()->gte('access_enum', '3')) + ->set('access_enum', $qbUpdate->func()->subtract( + 'access_enum', + $qbUpdate->createNamedParameter(3, IQueryBuilder::PARAM_INT) + )) + ->where($qbUpdate->expr()->gte('access_enum', $qbUpdate->createNamedParameter(3, IQueryBuilder::PARAM_INT))) ->executeStatement(); } }