Store the tag type for the post targets

This commit is contained in:
Michael
2022-04-23 11:39:19 +00:00
parent 1c0c787d1c
commit 060597f619
8 changed files with 96 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 2022.05-dev (Siberian Iris)
-- DB_UPDATE_VERSION 1458
-- DB_UPDATE_VERSION 1459
-- ------------------------------------------
@@ -232,6 +232,7 @@ CREATE TABLE IF NOT EXISTS `tag` (
`id` int unsigned NOT NULL auto_increment COMMENT '',
`name` varchar(96) NOT NULL DEFAULT '' COMMENT '',
`url` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
`type` tinyint unsigned COMMENT 'Type of the tag (Unknown, Collection or Account)',
PRIMARY KEY(`id`),
UNIQUE INDEX `type_name_url` (`name`,`url`),
INDEX `url` (`url`)
@@ -2235,7 +2236,8 @@ CREATE VIEW `tag-view` AS SELECT
`post-tag`.`tid` AS `tid`,
`post-tag`.`cid` AS `cid`,
CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END AS `name`,
CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END AS `url`
CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END AS `url`,
CASE `cid` WHEN 0 THEN `tag`.`type` ELSE 1 END AS `tag-type`
FROM `post-tag`
LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`;