Preparations for "featured" posts

This commit is contained in:
Michael 2022-04-06 13:34:11 +00:00
commit a1dd299eb3
8 changed files with 125 additions and 5 deletions

View file

@ -55,7 +55,7 @@
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1455);
define('DB_UPDATE_VERSION', 1456);
}
return [
@ -1103,6 +1103,17 @@ return [
"uid" => ["uid"],
]
],
"post-collection" => [
"comment" => "Collection of posts",
"fields" => [
"uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
"type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
],
"indexes" => [
"PRIMARY" => ["uri-id", "type"],
"type" => ["type"],
]
],
"post-content" => [
"comment" => "Content for all posts",
"fields" => [

View file

@ -93,6 +93,7 @@
"parent-origin" => ["post-thread-user", "origin"],
"mention" => ["post-thread-user", "mention"],
"global" => ["post-user", "global"],
"featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-user`.`uri-id`)",
"network" => ["post-user", "network"],
"vid" => ["post-user", "vid"],
"psid" => ["post-user", "psid"],
@ -251,6 +252,7 @@
"origin" => ["post-thread-user", "origin"],
"mention" => ["post-thread-user", "mention"],
"global" => ["post-user", "global"],
"featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread-user`.`uri-id`)",
"network" => ["post-thread-user", "network"],
"vid" => ["post-user", "vid"],
"psid" => ["post-thread-user", "psid"],
@ -395,6 +397,7 @@
"visible" => ["post", "visible"],
"deleted" => ["post", "deleted"],
"global" => ["post", "global"],
"featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post`.`uri-id`)",
"network" => ["post", "network"],
"vid" => ["post", "vid"],
"verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
@ -514,6 +517,7 @@
"visible" => ["post", "visible"],
"deleted" => ["post", "deleted"],
"global" => ["post", "global"],
"featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread`.`uri-id`)",
"network" => ["post-thread", "network"],
"vid" => ["post", "vid"],
"verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",