From 0a738c8ce3965da40016771658b7bda116576eee Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 27 May 2023 18:19:41 -0400 Subject: [PATCH] [Database version 1520] Reset user.parent-uid to null if it is set to zero --- database.sql | 2 +- static/dbstructure.config.php | 3 ++- update.php | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/database.sql b/database.sql index 697f250fee..d61a3eda5a 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2023.09-dev (Giant Rhubarb) --- DB_UPDATE_VERSION 1519 +-- DB_UPDATE_VERSION 1520 -- ------------------------------------------ diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 1b3e348759..8ff6604121 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -54,8 +54,9 @@ use Friendica\Database\DBA; +// This file is required several times during the test in DbaDefinition which justifies this condition if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1519); + define('DB_UPDATE_VERSION', 1520); } return [ diff --git a/update.php b/update.php index 3cd0a45a7b..14219bcdcb 100644 --- a/update.php +++ b/update.php @@ -1326,3 +1326,10 @@ function update_1518() return Update::SUCCESS; } + +function update_1520(): int +{ + DBA::update('user', ['parent-uid' => null], ['parent-uid' => 0]); + + return Update::SUCCESS; +}