-- ------------------------------------------
--- Friendica 2024.03-dev (Yellow Archangel)
--- DB_UPDATE_VERSION 1544
+-- Friendica 2024.06-dev (Yellow Archangel)
+-- DB_UPDATE_VERSION 1559
-- ------------------------------------------
`access-key` varchar(1) COMMENT 'Access key',
`include-tags` varchar(1023) COMMENT 'Comma separated list of tags that will be included in the channel',
`exclude-tags` varchar(1023) COMMENT 'Comma separated list of tags that aren\'t allowed in the channel',
+ `min-size` int unsigned COMMENT 'Minimum post size',
+ `max-size` int unsigned COMMENT 'Maximum post size',
`full-text-search` varchar(1023) COMMENT 'Full text search pattern, see https://mariadb.com/kb/en/full-text-index-overview/#in-boolean-mode',
`media-type` smallint unsigned COMMENT 'Filtered media types',
+ `languages` mediumtext COMMENT 'Desired languages',
+ `publish` boolean COMMENT 'publish channel content',
+ `valid` boolean COMMENT 'Set, when the full-text-search is valid',
PRIMARY KEY(`id`),
INDEX `uid` (`uid`),
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
`relation-score` smallint unsigned COMMENT 'score for interactions of relation-cid on cid',
`thread-score` smallint unsigned COMMENT 'score for interactions of cid on threads of relation-cid',
`relation-thread-score` smallint unsigned COMMENT 'score for interactions of relation-cid on threads of cid',
+ `post-score` smallint unsigned COMMENT 'score for the amount of posts from cid that can be seen by relation-cid',
PRIMARY KEY(`cid`,`relation-cid`),
INDEX `relation-cid` (`relation-cid`),
FOREIGN KEY (`cid`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
CREATE TABLE IF NOT EXISTS `post-counts` (
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
`vid` smallint unsigned NOT NULL COMMENT 'Id of the verb table entry that contains the activity verbs',
- `reaction` varchar(1) NOT NULL COMMENT 'Emoji Reaction',
+ `reaction` varchar(4) NOT NULL COMMENT 'Emoji Reaction',
`parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
`count` int unsigned DEFAULT 0 COMMENT 'Number of activities',
PRIMARY KEY(`uri-id`,`vid`,`reaction`),
`location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
`coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
`language` text COMMENT 'Language information about this post',
+ `sensitive` boolean COMMENT 'If true, this post contains sensitive content',
`app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
`rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
`rendered-html` mediumtext COMMENT 'item.body converted to html',
PRIMARY KEY(`uri-id`),
INDEX `plink` (`plink`(191)),
INDEX `resource-id` (`resource-id`),
- FULLTEXT INDEX `title-content-warning-body` (`title`,`content-warning`,`body`),
INDEX `quote-uri-id` (`quote-uri-id`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`quote-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
`contact-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Person, organisation, news, community, relay',
- `media-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Type of media in a bit array (1 = image, 2 = video, 4 = audio',
- `language` varbinary(128) COMMENT 'Language information about this post',
+ `media-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Type of media in a bit array (1 = image, 2 = video, 4 = audio)',
+ `language` char(2) COMMENT 'Language information about this post in the ISO 639-1 format',
`searchtext` mediumtext COMMENT 'Simplified text for the full text search',
+ `size` int unsigned COMMENT 'Body size',
`created` datetime COMMENT '',
+ `network` char(4) COMMENT '',
`restricted` boolean NOT NULL DEFAULT '0' COMMENT 'If true, this post is either unlisted or not from a federated network',
`comments` mediumint unsigned COMMENT 'Number of comments',
`activities` mediumint unsigned COMMENT 'Number of activities (like, dislike, ...)',
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Question option';
+--
+-- TABLE post-searchindex
+--
+CREATE TABLE IF NOT EXISTS `post-searchindex` (
+ `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
+ `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
+ `media-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Type of media in a bit array (1 = image, 2 = video, 4 = audio)',
+ `language` char(2) COMMENT 'Language information about this post in the ISO 639-1 format',
+ `searchtext` mediumtext COMMENT 'Simplified text for the full text search',
+ `size` int unsigned COMMENT 'Body size',
+ `created` datetime COMMENT '',
+ `restricted` boolean NOT NULL DEFAULT '0' COMMENT 'If true, this post is either unlisted or not from a federated network',
+ PRIMARY KEY(`uri-id`),
+ INDEX `owner-id` (`owner-id`),
+ INDEX `created` (`created`),
+ FULLTEXT INDEX `searchtext` (`searchtext`),
+ FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
+ FOREIGN KEY (`owner-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
+) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
+
--
-- TABLE post-tag
--
`post-reason` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Reason why the post arrived at the user',
`vid` smallint unsigned COMMENT 'Id of the verb table entry that contains the activity verbs',
`private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
+ `restrictions` tinyint unsigned COMMENT 'Bit array of post restrictions (1 = Reply, 2 = Like, 4 = Announce)',
`global` boolean NOT NULL DEFAULT '0' COMMENT '',
`visible` boolean NOT NULL DEFAULT '0' COMMENT '',
`deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been marked for deletion',
`net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
PRIMARY KEY(`id`),
INDEX `uid_is-default` (`uid`,`is-default`),
- FULLTEXT INDEX `pub_keywords` (`pub_keywords`),
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
`ignored` boolean COMMENT 'Posts from this contact are ignored',
`collapsed` boolean COMMENT 'Posts from this contact are collapsed',
`hidden` boolean COMMENT 'This contact is hidden from the others',
+ `channel-only` boolean COMMENT 'This contact is displayed only in channels, but not in the network stream.',
`is-blocked` boolean COMMENT 'User is blocked by this contact',
`channel-frequency` tinyint unsigned COMMENT 'Controls the frequency of the appearance of this contact in channels',
`pending` boolean COMMENT '',
`application-token`.`follow` AS `follow`,
`application-token`.`push` AS `push`
FROM `application-token`
- INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`;
+ INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`
+ INNER JOIN `user` ON `user`.`uid` = `application-token`.`uid` AND `user`.`verified` AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND NOT `user`.`account_expired`;
--
-- VIEW circle-member-view
STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`;
+--
+-- VIEW post-searchindex-user-view
+--
+DROP VIEW IF EXISTS `post-searchindex-user-view`;
+CREATE VIEW `post-searchindex-user-view` AS SELECT
+ `post-thread-user`.`uid` AS `uid`,
+ `post-searchindex`.`uri-id` AS `uri-id`,
+ `post-searchindex`.`owner-id` AS `owner-id`,
+ `post-searchindex`.`media-type` AS `media-type`,
+ `post-searchindex`.`language` AS `language`,
+ `post-searchindex`.`searchtext` AS `searchtext`,
+ `post-searchindex`.`size` AS `size`,
+ `post-thread-user`.`commented` AS `commented`,
+ `post-thread-user`.`received` AS `received`,
+ `post-thread-user`.`created` AS `created`,
+ `post-thread-user`.`network` AS `network`,
+ `post-searchindex`.`language` AS `restricted`,
+ 0 AS `comments`,
+ 0 AS `activities`
+ FROM `post-thread-user`
+ INNER JOIN `post-searchindex` ON `post-searchindex`.`uri-id` = `post-thread-user`.`uri-id`
+ 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`
+ 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 NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = `post-thread-user`.`uid` AND `cid` IN (`authorcontact`.`id`, `ownercontact`.`id`) AND (`blocked` OR `ignored`))
+ AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`);
+
--
-- VIEW post-user-view
--
`post-content`.`plink` AS `plink`,
`post-content`.`location` AS `location`,
`post-content`.`coord` AS `coord`,
+ `post-content`.`sensitive` AS `sensitive`,
+ `post-user`.`restrictions` AS `restrictions`,
`post-content`.`app` AS `app`,
`post-content`.`object-type` AS `object-type`,
`post-content`.`object` AS `object`,
`post-content`.`plink` AS `plink`,
`post-content`.`location` AS `location`,
`post-content`.`coord` AS `coord`,
+ `post-content`.`sensitive` AS `sensitive`,
+ `post-user`.`restrictions` AS `restrictions`,
`post-content`.`app` AS `app`,
`post-content`.`object-type` AS `object-type`,
`post-content`.`object` AS `object`,
`post-content`.`plink` AS `plink`,
`post-content`.`location` AS `location`,
`post-content`.`coord` AS `coord`,
+ `post-content`.`sensitive` AS `sensitive`,
`post-content`.`app` AS `app`,
`post-content`.`object-type` AS `object-type`,
`post-content`.`object` AS `object`,
`post-content`.`plink` AS `plink`,
`post-content`.`location` AS `location`,
`post-content`.`coord` AS `coord`,
+ `post-content`.`sensitive` AS `sensitive`,
`post-content`.`app` AS `app`,
`post-content`.`object-type` AS `object-type`,
`post-content`.`object` AS `object`,
LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`;
---
--- VIEW network-item-view
---
-DROP VIEW IF EXISTS `network-item-view`;
-CREATE VIEW `network-item-view` AS SELECT
- `post-user`.`uri-id` AS `uri-id`,
- `post-thread-user`.`post-user-id` AS `parent`,
- `post-user`.`received` AS `received`,
- `post-thread-user`.`commented` AS `commented`,
- `post-user`.`created` AS `created`,
- `post-user`.`uid` AS `uid`,
- `post-thread-user`.`starred` AS `starred`,
- `post-thread-user`.`mention` AS `mention`,
- `post-user`.`network` AS `network`,
- `post-user`.`unseen` AS `unseen`,
- `post-user`.`gravity` AS `gravity`,
- `post-user`.`contact-id` AS `contact-id`,
- `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`
- 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`
- 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 NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = `post-thread-user`.`uid` AND `cid` IN (`authorcontact`.`id`, `ownercontact`.`id`) AND (`blocked` OR `ignored`))
- AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`);
-
--
-- VIEW network-thread-view
--
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 NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = `post-thread-user`.`uid` AND `cid` IN (`authorcontact`.`id`, `ownercontact`.`id`) AND (`blocked` OR `ignored`))
- AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`);
+ AND NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = `post-thread-user`.`uid` AND `cid` IN (`post-thread-user`.`author-id`, `post-thread-user`.`owner-id`, `post-thread-user`.`causer-id`) AND (`blocked` OR `ignored` OR `channel-only`))
+ AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`);
--
-- VIEW owner-view