From 76cc8eaff87eba930aaf3f70a1d3d7233bbdf2af Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 21 Aug 2023 08:07:10 -0400 Subject: [PATCH] [Database 1528] Add expected index for foreign key user-gserver.gsid --- database.sql | 3 ++- doc/database/db_user-gserver.md | 1 + static/dbstructure.config.php | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/database.sql b/database.sql index b0f3ca7962..89a80b170b 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2023.09-dev (Giant Rhubarb) --- DB_UPDATE_VERSION 1527 +-- DB_UPDATE_VERSION 1528 -- ------------------------------------------ @@ -109,6 +109,7 @@ CREATE TABLE IF NOT EXISTS `user-gserver` ( `gsid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Gserver id', `ignored` boolean NOT NULL DEFAULT '0' COMMENT 'server accounts are ignored for the user', PRIMARY KEY(`uid`,`gsid`), + INDEX `gsid` (`gsid`), FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE, FOREIGN KEY (`gsid`) REFERENCES `gserver` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User settings about remote servers'; diff --git a/doc/database/db_user-gserver.md b/doc/database/db_user-gserver.md index b49a288f43..6cfbe34eb1 100644 --- a/doc/database/db_user-gserver.md +++ b/doc/database/db_user-gserver.md @@ -18,6 +18,7 @@ Indexes | Name | Fields | | ------- | --------- | | PRIMARY | uid, gsid | +| gsid | gsid | Foreign Keys ------------ diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index dcda833aaf..cef6855364 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -56,7 +56,7 @@ 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', 1527); + define('DB_UPDATE_VERSION', 1528); } return [ @@ -168,6 +168,7 @@ return [ ], "indexes" => [ "PRIMARY" => ["uid", "gsid"], + "gsid" => ["gsid"] ], ], "item-uri" => [