-- ------------------------------------------
--- Friendica 2021.03-rc (Red Hot Poker)
--- DB_UPDATE_VERSION 1408
+-- Friendica 2021.06-rc (Siberian Iris)
+-- DB_UPDATE_VERSION 1419
-- ------------------------------------------
INDEX `blocked_uid` (`blocked`,`uid`),
INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
+ INDEX `batch_contact-type` (`batch`(64),`contact-type`),
INDEX `addr_uid` (`addr`(128),`uid`),
INDEX `nurl_uid` (`nurl`(128),`uid`),
INDEX `nick_uid` (`nick`(128),`uid`),
INDEX `uid_network_self_lastupdate` (`uid`,`network`,`self`,`last-update`),
INDEX `uid_lastitem` (`uid`,`last-item`),
INDEX `baseurl` (`baseurl`(64)),
+ INDEX `uid_contact-type` (`uid`,`contact-type`),
+ INDEX `uid_self_contact-type` (`uid`,`self`,`contact-type`),
+ INDEX `self_network_uid` (`self`,`network`,`uid`),
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
FOREIGN KEY (`gsid`) REFERENCES `gserver` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='ActivityPub compatible contacts - used in the ActivityPub implementation';
+--
+-- TABLE application
+--
+CREATE TABLE IF NOT EXISTS `application` (
+ `id` int unsigned NOT NULL auto_increment COMMENT 'generated index',
+ `client_id` varchar(64) NOT NULL COMMENT '',
+ `client_secret` varchar(64) NOT NULL COMMENT '',
+ `name` varchar(255) NOT NULL COMMENT '',
+ `redirect_uri` varchar(255) NOT NULL COMMENT '',
+ `website` varchar(255) COMMENT '',
+ `scopes` varchar(255) COMMENT '',
+ `read` boolean COMMENT 'Read scope',
+ `write` boolean COMMENT 'Write scope',
+ `follow` boolean COMMENT 'Follow scope',
+ `push` boolean COMMENT 'Push scope',
+ PRIMARY KEY(`id`),
+ UNIQUE INDEX `client_id` (`client_id`)
+) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth application';
+
+--
+-- TABLE application-token
+--
+CREATE TABLE IF NOT EXISTS `application-token` (
+ `application-id` int unsigned NOT NULL COMMENT '',
+ `uid` mediumint unsigned NOT NULL COMMENT 'Owner User id',
+ `code` varchar(64) NOT NULL COMMENT '',
+ `access_token` varchar(64) NOT NULL COMMENT '',
+ `created_at` datetime NOT NULL COMMENT 'creation time',
+ `scopes` varchar(255) COMMENT '',
+ `read` boolean COMMENT 'Read scope',
+ `write` boolean COMMENT 'Write scope',
+ `follow` boolean COMMENT 'Follow scope',
+ `push` boolean COMMENT 'Push scope',
+ PRIMARY KEY(`application-id`,`uid`),
+ INDEX `uid_id` (`uid`,`application-id`),
+ FOREIGN KEY (`application-id`) REFERENCES `application` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
+ FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
+) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth user token';
+
--
-- TABLE attach
--
`from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
`from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
`contact-id` varchar(255) COMMENT 'contact.id',
+ `author-id` int unsigned COMMENT 'Link to the contact table with uid=0 of the author of the mail',
`convid` int unsigned COMMENT 'conv.id',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`body` mediumtext COMMENT '',
`replied` boolean NOT NULL DEFAULT '0' COMMENT '',
`unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
`uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
+ `uri-id` int unsigned COMMENT 'Item-uri id of the related mail',
`parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
+ `parent-uri-id` int unsigned COMMENT 'Item-uri id of the parent of the related mail',
+ `thr-parent` varchar(255) COMMENT '',
+ `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
PRIMARY KEY(`id`),
INDEX `uid_seen` (`uid`,`seen`),
INDEX `uri` (`uri`(64)),
INDEX `parent-uri` (`parent-uri`(64)),
INDEX `contactid` (`contact-id`(32)),
- FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
+ INDEX `author-id` (`author-id`),
+ INDEX `uri-id` (`uri-id`),
+ INDEX `parent-uri-id` (`parent-uri-id`),
+ INDEX `thr-parent-id` (`thr-parent-id`),
+ FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE,
+ FOREIGN KEY (`author-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT,
+ 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
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
--
`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
`author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
`causer-id` int unsigned COMMENT 'Link to the contact table with uid=0 of the contact that caused the item creation',
- `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
+ `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, image, article, ...)',
`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',
`global` boolean NOT NULL DEFAULT '0' COMMENT '',
`preview-height` smallint unsigned COMMENT 'Height of the preview picture',
`preview-width` smallint unsigned COMMENT 'Width of the preview picture',
`description` text COMMENT '',
+ `name` varchar(255) COMMENT 'Name of the media',
+ `author-url` varbinary(255) COMMENT 'URL of the author of the media',
+ `author-name` varchar(255) COMMENT 'Name of the author of the media',
+ `author-image` varbinary(255) COMMENT 'Image of the author of the media',
+ `publisher-url` varbinary(255) COMMENT 'URL of the publisher of the media',
+ `publisher-name` varchar(255) COMMENT 'Name of the publisher of the media',
+ `publisher-image` varbinary(255) COMMENT 'Image of the publisher of the media',
PRIMARY KEY(`id`),
UNIQUE INDEX `uri-id-url` (`uri-id`,`url`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
`author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
`causer-id` int unsigned COMMENT 'Link to the contact table with uid=0 of the contact that caused the item creation',
- `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
+ `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, image, article, ...)',
+ `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',
`global` boolean NOT NULL DEFAULT '0' COMMENT '',
INDEX `uid_contactid` (`uid`,`contact-id`),
INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
INDEX `uid_unseen` (`uid`,`unseen`),
+ INDEX `uid_hidden_uri-id` (`uid`,`hidden`,`uri-id`),
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,
INDEX `done_pid_priority_created` (`done`,`pid`,`priority`,`created`)
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
+--
+-- VIEW application-view
+--
+DROP VIEW IF EXISTS `application-view`;
+CREATE VIEW `application-view` AS SELECT
+ `application`.`id` AS `id`,
+ `application-token`.`uid` AS `uid`,
+ `application`.`name` AS `name`,
+ `application`.`redirect_uri` AS `redirect_uri`,
+ `application`.`website` AS `website`,
+ `application`.`client_id` AS `client_id`,
+ `application`.`client_secret` AS `client_secret`,
+ `application-token`.`code` AS `code`,
+ `application-token`.`access_token` AS `access_token`,
+ `application-token`.`created_at` AS `created_at`,
+ `application-token`.`scopes` AS `scopes`,
+ `application-token`.`read` AS `read`,
+ `application-token`.`write` AS `write`,
+ `application-token`.`follow` AS `follow`,
+ `application-token`.`push` AS `push`
+ FROM `application-token`
+ INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`;
+
--
-- VIEW post-user-view
--
`post-user`.`received` AS `received`,
`post-thread-user`.`changed` AS `changed`,
`post-user`.`post-type` AS `post-type`,
+ `post-user`.`post-reason` AS `post-reason`,
`post-user`.`private` AS `private`,
`post-thread-user`.`pubmail` AS `pubmail`,
`post-user`.`visible` AS `visible`,
`post-thread-user`.`starred` AS `starred`,
+ `post-thread-user`.`pinned` AS `pinned`,
`post-user`.`unseen` AS `unseen`,
`post-user`.`deleted` AS `deleted`,
`post-user`.`origin` AS `origin`,
`post-thread-user`.`received` AS `received`,
`post-thread-user`.`changed` AS `changed`,
`post-user`.`post-type` AS `post-type`,
+ `post-user`.`post-reason` AS `post-reason`,
`post-user`.`private` AS `private`,
`post-thread-user`.`pubmail` AS `pubmail`,
`post-thread-user`.`ignored` AS `ignored`,
`post-user`.`visible` AS `visible`,
`post-thread-user`.`starred` AS `starred`,
+ `post-thread-user`.`pinned` AS `pinned`,
`post-thread-user`.`unseen` AS `unseen`,
`post-user`.`deleted` AS `deleted`,
`post-thread-user`.`origin` AS `origin`,
`post-user`.`gravity` AS `gravity`,
`post-user`.`received` AS `received`,
`post-user`.`network` AS `network`,
+ `post-user`.`author-id` AS `author-id`,
`tag`.`name` AS `name`
FROM `post-tag`
INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`