]> git.mxchange.org Git - friendica.git/blobdiff - database.sql
Move /parse_url module to /parseurl
[friendica.git] / database.sql
index 3e1c44f99a23e20cf77a3f89da7193630e432d9d..da32e1be6fa55c9093c6f00e22b4634040ba115e 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2021.03-dev (Red Hot Poker)
--- DB_UPDATE_VERSION 1400
+-- DB_UPDATE_VERSION 1403
 -- ------------------------------------------
 
 
@@ -889,7 +889,7 @@ CREATE TABLE IF NOT EXISTS `notify` (
        `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',
@@ -915,17 +915,15 @@ CREATE TABLE IF NOT EXISTS `notify` (
 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='';
@@ -961,15 +959,17 @@ CREATE TABLE IF NOT EXISTS `openwebauth-token` (
 -- 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
 --
@@ -1233,11 +1233,11 @@ CREATE TABLE IF NOT EXISTS `post-user` (
         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`),
@@ -1617,6 +1617,7 @@ CREATE VIEW `post-view` AS SELECT
        `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`,
@@ -1748,7 +1749,6 @@ DROP VIEW IF EXISTS `post-thread-view`;
 CREATE VIEW `post-thread-view` AS SELECT 
        `post-user`.`id` AS `id`,
        `item`.`id` AS `item-id`,
-       `post-user`.`id` AS `iid`,
        `post-user`.`id` AS `post-user-id`,
        `post-thread-user`.`uid` AS `uid`,
        `parent-post`.`id` AS `parent`,