-- ------------------------------------------
-- Friendica 2021.03-dev (Red Hot Poker)
--- DB_UPDATE_VERSION 1404
+-- DB_UPDATE_VERSION 1406
-- ------------------------------------------
`next_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT 'Next connection request',
PRIMARY KEY(`id`),
UNIQUE INDEX `nurl` (`nurl`(190)),
- INDEX `next_contact` (`next_contact`)
+ INDEX `next_contact` (`next_contact`),
+ INDEX `network` (`network`)
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
--
PRIMARY KEY(`uid`),
INDEX `nickname` (`nickname`(32)),
INDEX `parent-uid` (`parent-uid`),
+ INDEX `guid` (`guid`),
+ INDEX `email` (`email`(64)),
FOREIGN KEY (`parent-uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
INDEX `network_uid_lastupdate` (`network`,`uid`,`last-update`),
INDEX `uid_network_self_lastupdate` (`uid`,`network`,`self`,`last-update`),
INDEX `uid_lastitem` (`uid`,`last-item`),
+ INDEX `baseurl` (`baseurl`(64)),
INDEX `gsid` (`gsid`),
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`gsid`) REFERENCES `gserver` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
CREATE TABLE IF NOT EXISTS `verb` (
`id` smallint unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL DEFAULT '' COMMENT '',
- PRIMARY KEY(`id`)
+ PRIMARY KEY(`id`),
+ INDEX `name` (`name`)
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activity Verbs';
--
`timestamp` int unsigned NOT NULL DEFAULT 0 COMMENT 'file timestamp to check for reloads',
`plugin_admin` boolean NOT NULL DEFAULT '0' COMMENT '1 = has admin config, 0 = has no admin config',
PRIMARY KEY(`id`),
+ INDEX `installed_name` (`installed`,`name`),
UNIQUE INDEX `name` (`name`)
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registered addons';
`expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
`type` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`last_update` varchar(255) NOT NULL DEFAULT '' COMMENT '',
- PRIMARY KEY(`id`)
+ PRIMARY KEY(`id`),
+ INDEX `expire` (`expire`)
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
--
`function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
`priority` smallint unsigned NOT NULL DEFAULT 0 COMMENT 'not yet implemented - can be used to sort conflicts in hook handling by calling handlers in priority order',
PRIMARY KEY(`id`),
+ INDEX `priority` (`priority`),
UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
INDEX `author-id` (`author-id`),
INDEX `causer-id` (`causer-id`),
INDEX `vid` (`vid`),
- INDEX `received` (`received`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`parent-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`thr-parent-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
`plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
PRIMARY KEY(`uri-id`),
INDEX `plink` (`plink`(191)),
+ INDEX `resource-id` (`resource-id`),
FULLTEXT INDEX `title-content-warning-body` (`title`,`content-warning`,`body`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
PRIMARY KEY(`id`),
UNIQUE INDEX `uid_uri-id` (`uid`,`uri-id`),
INDEX `uri-id` (`uri-id`),
- INDEX `contact-id` (`contact-id`),
- INDEX `psid` (`psid`),
- INDEX `uid_hidden` (`uid`,`hidden`),
- INDEX `event-id` (`event-id`),
- INDEX `uid_wall` (`uid`,`wall`),
- INDEX `parent-uri-id_uid` (`parent-uri-id`,`uid`),
+ INDEX `parent-uri-id` (`parent-uri-id`),
INDEX `thr-parent-id` (`thr-parent-id`),
INDEX `external-id` (`external-id`),
INDEX `owner-id` (`owner-id`),
- INDEX `author-id_uid` (`author-id`,`uid`),
+ INDEX `author-id` (`author-id`),
INDEX `causer-id` (`causer-id`),
INDEX `vid` (`vid`),
- INDEX `uid_received` (`uid`,`received`),
+ INDEX `contact-id` (`contact-id`),
+ INDEX `event-id` (`event-id`),
+ INDEX `psid` (`psid`),
+ INDEX `author-id_uid` (`author-id`,`uid`),
+ INDEX `author-id_received` (`author-id`,`received`),
+ INDEX `parent-uri-id_uid` (`parent-uri-id`,`uid`),
+ INDEX `uid_hidden` (`uid`,`hidden`),
+ INDEX `uid_contactid` (`uid`,`contact-id`),
INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
- INDEX `uid_network_received` (`uid`,`network`,`received`),
- INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
- INDEX `authorid_received` (`author-id`,`received`),
+ INDEX `uid_unseen` (`uid`,`unseen`),
INDEX `uid_unseen_wall` (`uid`,`unseen`,`wall`),
- INDEX `uid_eventid` (`uid`,`event-id`),
- INDEX `psid_wall` (`psid`,`wall`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`parent-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`thr-parent-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
`psid` int unsigned COMMENT 'ID of the permission set of this post',
`post-user-id` int unsigned COMMENT 'Id of the post-user table',
PRIMARY KEY(`uid`,`uri-id`),
- INDEX `uid_wall` (`uid`,`wall`),
- INDEX `uid_pinned` (`uid`,`pinned`),
INDEX `uri-id` (`uri-id`),
+ INDEX `owner-id` (`owner-id`),
+ INDEX `author-id` (`author-id`),
+ INDEX `causer-id` (`causer-id`),
+ INDEX `uid` (`uid`),
INDEX `contact-id` (`contact-id`),
INDEX `psid` (`psid`),
INDEX `post-user-id` (`post-user-id`),
- INDEX `owner-id` (`owner-id`),
- INDEX `causer-id` (`causer-id`),
- INDEX `uid_received` (`uid`,`received`),
- INDEX `uid_commented` (`uid`,`commented`),
- INDEX `uid_changed` (`uid`,`changed`),
- INDEX `uid_contact-id` (`uid`,`contact-id`,`received`),
- INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
- INDEX `uid_network_received` (`uid`,`network`,`received`),
- INDEX `uid_network_commented` (`uid`,`network`,`commented`),
- INDEX `uid_contact-id_received` (`uid`,`contact-id`,`received`),
+ INDEX `commented` (`commented`),
+ INDEX `received` (`received`),
INDEX `author-id_received` (`author-id`,`received`),
- INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
- INDEX `uid_unseen_wall` (`uid`,`unseen`,`wall`),
+ INDEX `uid_pinned` (`uid`,`pinned`),
+ INDEX `uid_commented` (`uid`,`commented`),
INDEX `mention_uid` (`mention`,`uid`),
- INDEX `psid_wall` (`psid`,`wall`),
- INDEX `received` (`received`),
- INDEX `commented` (`commented`),
- INDEX `changed` (`changed`),
+ INDEX `uid_mention` (`uid`,`mention`),
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 RESTRICT,
FOREIGN KEY (`author-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT,
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
`term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
PRIMARY KEY(`id`),
- INDEX `uid` (`uid`),
+ INDEX `uid_term` (`uid`,`term`(64)),
+ INDEX `term` (`term`(64)),
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
--
--- VIEW post-view
+-- VIEW post-user-view
--
-DROP VIEW IF EXISTS `post-view`;
-CREATE VIEW `post-view` AS SELECT
+DROP VIEW IF EXISTS `post-user-view`;
+CREATE VIEW `post-user-view` AS SELECT
`post-user`.`id` AS `id`,
`post-user`.`id` AS `post-user-id`,
`post-user`.`uid` AS `uid`,
`owner`.`network` AS `owner-network`,
`owner`.`blocked` AS `owner-blocked`,
`owner`.`hidden` AS `owner-hidden`,
+ `owner`.`contact-type` AS `owner-contact-type`,
`post-user`.`causer-id` AS `causer-id`,
`causer`.`url` AS `causer-link`,
`causer`.`addr` AS `causer-addr`,
`parent-post-author`.`network` AS `parent-author-network`
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 `contact` ON `contact`.`id` = `post-user`.`contact-id`
- LEFT JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
- LEFT JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
+ STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
+ STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
+ STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`;
--
--- VIEW post-thread-view
+-- VIEW post-thread-user-view
--
-DROP VIEW IF EXISTS `post-thread-view`;
-CREATE VIEW `post-thread-view` AS SELECT
+DROP VIEW IF EXISTS `post-thread-user-view`;
+CREATE VIEW `post-thread-user-view` AS SELECT
`post-user`.`id` AS `id`,
`post-user`.`id` AS `post-user-id`,
`post-thread-user`.`uid` AS `uid`,
`owner`.`network` AS `owner-network`,
`owner`.`blocked` AS `owner-blocked`,
`owner`.`hidden` AS `owner-hidden`,
+ `owner`.`contact-type` AS `owner-contact-type`,
`post-thread-user`.`causer-id` AS `causer-id`,
`causer`.`url` AS `causer-link`,
`causer`.`addr` AS `causer-addr`,
`parent-post-author`.`network` AS `parent-author-network`
FROM `post-thread-user`
INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
- LEFT JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
- LEFT JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
- LEFT JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
+ STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
+ STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
+ STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
`post-user`.`private` AS `private`,
`post-user`.`wall` AS `wall`,
`post-user`.`origin` AS `origin`,
+ `post-user`.`global` AS `global`,
`post-user`.`gravity` AS `gravity`,
`post-user`.`received` AS `received`,
+ `post-user`.`network` AS `network`,
`tag`.`name` AS `name`
FROM `post-tag`
INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`