]> git.mxchange.org Git - friendica.git/commitdiff
Add "uri-id" to the "thread" table
authorMichael <heluecht@pirati.ca>
Thu, 28 May 2020 21:44:55 +0000 (21:44 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 28 May 2020 21:44:55 +0000 (21:44 +0000)
src/Model/Item.php
static/dbstructure.config.php
update.php

index a6036e6bdbe8c458e25f7e1dda44a948e331b294..f014ed096e16a8def8a07452af4307d0f80bbaa6 100644 (file)
@@ -3110,7 +3110,7 @@ class Item
        private static function addThread($itemid, $onlyshadow = false)
        {
                $fields = ['uid', 'created', 'edited', 'commented', 'received', 'changed', 'wall', 'private', 'pubmail',
-                       'moderated', 'visible', 'starred', 'contact-id', 'post-type',
+                       'moderated', 'visible', 'starred', 'contact-id', 'post-type', 'uri-id',
                        'deleted', 'origin', 'forum_mode', 'mention', 'network', 'author-id', 'owner-id'];
                $condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid];
                $item = self::selectFirst($fields, $condition);
@@ -3131,7 +3131,7 @@ class Item
        private static function updateThread($itemid, $setmention = false)
        {
                $fields = ['uid', 'guid', 'created', 'edited', 'commented', 'received', 'changed', 'post-type',
-                       'wall', 'private', 'pubmail', 'moderated', 'visible', 'starred', 'contact-id',
+                       'wall', 'private', 'pubmail', 'moderated', 'visible', 'starred', 'contact-id', 'uri-id',
                        'deleted', 'origin', 'forum_mode', 'network', 'author-id', 'owner-id'];
                $condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid];
 
index fc7abded509b153ee82a0a949dbd2023f3dfb779..9fccdf14b633327fe7632ef0f3dbdce65df97f08 100755 (executable)
@@ -54,7 +54,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1350);
+       define('DB_UPDATE_VERSION', 1351);
 }
 
 return [
@@ -1343,6 +1343,7 @@ return [
                "fields" => [
                        "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"],
                                "comment" => "sequential ID"],
+                       "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
                        "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
                        "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
                        "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Item owner"],
@@ -1381,6 +1382,7 @@ return [
                        "uid_commented" => ["uid", "commented"],
                        "uid_wall_received" => ["uid", "wall", "received"],
                        "private_wall_origin_commented" => ["private", "wall", "origin", "commented"],
+                       "uri-id" => ["uri-id"],
                ]
        ],
        "tokens" => [
index 48d44813b15f23d58634bc22fab494f574abeddf..acbb458f7fb62f436077ecc1417a865678f3c898 100644 (file)
@@ -498,4 +498,13 @@ function update_1349()
        }
 
        return Update::SUCCESS;
-}
\ No newline at end of file
+}
+
+function update_1351()
+{
+       if (!DBA::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id` SET `thread`.`uri-id` = `item`.`uri-id`")) {
+               return Update::FAILED;
+       }
+
+       return Update::SUCCESS;
+}