friendica/static/dbview.config.php

58 lines
1.9 KiB
PHP
Raw Normal View History

2020-04-23 06:19:44 +00:00
<?php
/**
* @copyright Copyright (C) 2020, Friendica
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Main view structure configuration file.
*
* Here are described all the view Friendica needs to work.
*
* Syntax (braces indicate optionale values):
* "<view name>" => [
* "fields" => [
2020-04-23 07:02:18 +00:00
* "<field name>" => ["table", "field"],
2020-04-23 06:19:44 +00:00
* "<field name>" => "SQL expression",
* ...
* ],
* "query" => "FROM `table` INNER JOIN `other-table` ..."
* ],
* ],
*
* If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value in dbstructure.config.php.
*
*/
return [
"tag-view" => [
2020-04-24 05:37:06 +00:00
"fields" => [
"uri-id" => ["post-tag", "uri-id"],
2020-04-23 07:02:18 +00:00
"uri" => ["item-uri", "uri"],
"guid" => ["item-uri", "guid"],
"type" => ["post-tag", "type"],
"tid" => ["post-tag", "tid"],
"cid" => ["post-tag", "cid"],
2020-04-23 06:19:44 +00:00
"name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
2020-04-24 05:37:06 +00:00
"url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
],
2020-04-23 06:19:44 +00:00
"query" => "FROM `post-tag`
INNER JOIN `item-uri` ON `item-uri`.id = `post-tag`.`uri-id`
LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
2020-04-24 05:39:30 +00:00
],
2020-04-23 06:19:44 +00:00
];