]> git.mxchange.org Git - friendica.git/blobdiff - database.sql
Merge pull request #13308 from MrPetovan/bug/13216-toggle-mobile-local
[friendica.git] / database.sql
index 5b6f1695c389c0c3bdc3cd933349e87ba9bcb5ea..5a8cee23c4a88f50949da1cac4009a3d1e83722e 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2023.09-dev (Giant Rhubarb)
--- DB_UPDATE_VERSION 1522
+-- DB_UPDATE_VERSION 1523
 -- ------------------------------------------
 
 
@@ -1695,7 +1695,7 @@ CREATE TABLE IF NOT EXISTS `report` (
        `uid` mediumint unsigned COMMENT 'Reporting user',
        `reporter-id` int unsigned COMMENT 'Reporting contact',
        `cid` int unsigned NOT NULL COMMENT 'Reported contact',
-       `gsid` int unsigned NOT NULL COMMENT 'Reported contact server',
+       `gsid` int unsigned COMMENT 'Reported contact server',
        `comment` text COMMENT 'Report',
        `category-id` int unsigned NOT NULL DEFAULT 1 COMMENT 'Report category, one of Entity\Report::CATEGORY_*',
        `forward` boolean COMMENT 'Forward the report to the remote server',
@@ -1712,6 +1712,7 @@ CREATE TABLE IF NOT EXISTS `report` (
         INDEX `cid` (`cid`),
         INDEX `reporter-id` (`reporter-id`),
         INDEX `gsid` (`gsid`),
+        INDEX `last-editor-uid` (`last-editor-uid`),
         INDEX `assigned-uid` (`assigned-uid`),
         INDEX `status-resolution` (`status`,`resolution`),
         INDEX `created` (`created`),
@@ -1899,6 +1900,37 @@ CREATE VIEW `application-view` AS SELECT
        FROM `application-token`
                        INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`;
 
+--
+-- VIEW circle-member-view
+--
+DROP VIEW IF EXISTS `circle-member-view`;
+CREATE VIEW `circle-member-view` AS SELECT 
+       `group_member`.`id` AS `id`,
+       `group`.`uid` AS `uid`,
+       `group_member`.`contact-id` AS `contact-id`,
+       `contact`.`uri-id` AS `contact-uri-id`,
+       `contact`.`url` AS `contact-link`,
+       `contact`.`addr` AS `contact-addr`,
+       `contact`.`name` AS `contact-name`,
+       `contact`.`nick` AS `contact-nick`,
+       `contact`.`thumb` AS `contact-avatar`,
+       `contact`.`network` AS `contact-network`,
+       `contact`.`blocked` AS `contact-blocked`,
+       `contact`.`hidden` AS `contact-hidden`,
+       `contact`.`readonly` AS `contact-readonly`,
+       `contact`.`archive` AS `contact-archive`,
+       `contact`.`pending` AS `contact-pending`,
+       `contact`.`self` AS `contact-self`,
+       `contact`.`rel` AS `contact-rel`,
+       `contact`.`contact-type` AS `contact-contact-type`,
+       `group_member`.`gid` AS `circle-id`,
+       `group`.`visible` AS `circle-visible`,
+       `group`.`deleted` AS `circle-deleted`,
+       `group`.`name` AS `circle-name`
+       FROM `group_member`
+                       INNER JOIN `contact` ON `group_member`.`contact-id` = `contact`.`id`
+                       INNER JOIN `group` ON `group_member`.`gid` = `group`.`id`;
+
 --
 -- VIEW post-user-view
 --
@@ -2635,13 +2667,15 @@ CREATE VIEW `network-item-view` AS SELECT
        `ownercontact`.`contact-type` AS `contact-type`
        FROM `post-user`
                        INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`                     
-                       INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
+                       STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
+                       STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
+                       STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
                        LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
                        LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
-                       INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
                        WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
                        AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
                        AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
+                       AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
                        AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
                        AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`);
 
@@ -2664,12 +2698,14 @@ CREATE VIEW `network-thread-view` AS SELECT
        FROM `post-thread-user`
                        INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
                        STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
+                       STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
+                       STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
                        LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
                        LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
-                       LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
                        WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
                        AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
                        AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
+                       AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
                        AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
                        AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`);