-- ------------------------------------------
-- Friendica 2021.03-dev (Red Hot Poker)
--- DB_UPDATE_VERSION 1400
+-- DB_UPDATE_VERSION 1403
-- ------------------------------------------
`msg` mediumtext COMMENT '',
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
`link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
- `iid` int unsigned COMMENT 'item.id',
+ `iid` int unsigned COMMENT '',
`parent` int unsigned COMMENT '',
`uri-id` int unsigned COMMENT 'Item-uri id of the related post',
`parent-uri-id` int unsigned COMMENT 'Item-uri id of the parent of the related post',
CREATE TABLE IF NOT EXISTS `notify-threads` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
- `master-parent-item` int unsigned COMMENT '',
+ `master-parent-item` int unsigned COMMENT 'Deprecated',
`master-parent-uri-id` int unsigned COMMENT 'Item-uri id of the parent of the related post',
`parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
`receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
PRIMARY KEY(`id`),
- INDEX `master-parent-item` (`master-parent-item`),
INDEX `master-parent-uri-id` (`master-parent-uri-id`),
INDEX `receiver-uid` (`receiver-uid`),
INDEX `notify-id` (`notify-id`),
FOREIGN KEY (`notify-id`) REFERENCES `notify` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
- FOREIGN KEY (`master-parent-item`) REFERENCES `item` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`master-parent-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`receiver-uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
-- TABLE parsed_url
--
CREATE TABLE IF NOT EXISTS `parsed_url` (
- `url` varbinary(255) NOT NULL COMMENT 'page url',
+ `url_hash` binary(64) NOT NULL COMMENT 'page url hash',
`guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
`oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
+ `url` text NOT NULL COMMENT 'page url',
`content` mediumtext COMMENT 'page data',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
- PRIMARY KEY(`url`,`guessing`,`oembed`),
- INDEX `created` (`created`)
+ `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of expiration',
+ PRIMARY KEY(`url_hash`,`guessing`,`oembed`),
+ INDEX `created` (`created`),
+ INDEX `expires` (`expires`)
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
-
--
-- TABLE pconfig
--
INDEX `uid_hidden` (`uid`,`hidden`),
INDEX `event-id` (`event-id`),
INDEX `uid_wall` (`uid`,`wall`),
- INDEX `parent-uri-id` (`parent-uri-id`),
+ INDEX `parent-uri-id_uid` (`parent-uri-id`,`uid`),
INDEX `thr-parent-id` (`thr-parent-id`),
INDEX `external-id` (`external-id`),
INDEX `owner-id` (`owner-id`),
- INDEX `author-id` (`author-id`),
+ INDEX `author-id_uid` (`author-id`,`uid`),
INDEX `causer-id` (`causer-id`),
INDEX `vid` (`vid`),
INDEX `uid_received` (`uid`,`received`),
--
DROP VIEW IF EXISTS `post-view`;
CREATE VIEW `post-view` AS SELECT
- `item`.`id` AS `id`,
+ `post-user`.`id` AS `id`,
`item`.`id` AS `item-id`,
`post-user`.`id` AS `post-user-id`,
`post-user`.`uid` AS `uid`,
- `item`.`parent` AS `parent`,
- `parent-post`.`id` AS `parent-user-id`,
+ `parent-post`.`id` AS `parent`,
`item-uri`.`uri` AS `uri`,
`post-user`.`uri-id` AS `uri-id`,
`parent-item-uri`.`uri` AS `parent-uri`,
`post-user`.`unseen` AS `unseen`,
`post-user`.`deleted` AS `deleted`,
`post-user`.`origin` AS `origin`,
+ `post-thread-user`.`origin` AS `parent-origin`,
`post-thread-user`.`forum_mode` AS `forum_mode`,
`post-thread-user`.`mention` AS `mention`,
`post-user`.`global` AS `global`,
--
DROP VIEW IF EXISTS `post-thread-view`;
CREATE VIEW `post-thread-view` AS SELECT
- `item`.`id` AS `id`,
+ `post-user`.`id` AS `id`,
`item`.`id` AS `item-id`,
- `item`.`id` AS `iid`,
`post-user`.`id` AS `post-user-id`,
`post-thread-user`.`uid` AS `uid`,
- `item`.`parent` AS `parent`,
- `parent-post`.`id` AS `parent-user-id`,
+ `parent-post`.`id` AS `parent`,
`item-uri`.`uri` AS `uri`,
`post-thread-user`.`uri-id` AS `uri-id`,
`parent-item-uri`.`uri` AS `parent-uri`,
DROP VIEW IF EXISTS `network-item-view`;
CREATE VIEW `network-item-view` AS SELECT
`post-user`.`uri-id` AS `uri-id`,
- `item`.`parent` AS `parent`,
- `post-user`.`parent-uri-id` AS `parent-uri-id`,
+ `parent-post`.`id` AS `parent`,
`post-user`.`received` AS `received`,
`post-thread-user`.`commented` AS `commented`,
`post-user`.`created` AS `created`,
`post-user`.`contact-id` AS `contact-id`,
`ownercontact`.`contact-type` AS `contact-type`
FROM `post-user`
- STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
- LEFT JOIN `item` ON `item`.`uri-id` = `post-user`.`uri-id` AND `item`.`uid` = `post-user`.`uid`
+ STRAIGHT_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`
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`
+ LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
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`)
DROP VIEW IF EXISTS `network-thread-view`;
CREATE VIEW `network-thread-view` AS SELECT
`post-thread-user`.`uri-id` AS `uri-id`,
- `post-user`.`parent-uri-id` AS `parent-uri-id`,
- `item`.`id` AS `parent`,
+ `parent-post`.`id` AS `parent`,
`post-thread-user`.`received` AS `received`,
`post-thread-user`.`commented` AS `commented`,
`post-thread-user`.`created` AS `created`,
`ownercontact`.`contact-type` AS `contact-type`
FROM `post-thread-user`
INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
- LEFT JOIN `item` ON `item`.`uri-id` = `post-thread-user`.`uri-id` AND `item`.`uid` = `post-thread-user`.`uid`
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-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`
+ LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
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`)
CREATE VIEW `tag-search-view` AS SELECT
`post-tag`.`uri-id` AS `uri-id`,
`post-user`.`uid` AS `uid`,
+ `post-user`.`id` AS `iid`,
`post-user`.`private` AS `private`,
`post-user`.`wall` AS `wall`,
`post-user`.`origin` AS `origin`,