mirror of
https://github.com/friendica/friendica
synced 2025-04-24 07:10:11 +00:00
We now can define views
This commit is contained in:
parent
43b8bdea07
commit
63ebbb8a16
5 changed files with 243 additions and 2 deletions
|
@ -51,7 +51,7 @@
|
|||
use Friendica\Database\DBA;
|
||||
|
||||
if (!defined('DB_UPDATE_VERSION')) {
|
||||
define('DB_UPDATE_VERSION', 1339);
|
||||
define('DB_UPDATE_VERSION', 1340);
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
56
static/dbview.config.php
Executable file
56
static/dbview.config.php
Executable file
|
@ -0,0 +1,56 @@
|
|||
<?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" => [
|
||||
* "<field name>" => "`table`.`field`",
|
||||
* "<field name>" => "`other-table`.`field`",
|
||||
* "<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" => [
|
||||
"fields" => ["uri-id" => "`post-tag`.`uri-id`",
|
||||
"uri" => "`item-uri`.`uri`",
|
||||
"guid" => "`item-uri`.`guid`",
|
||||
"type" => "`post-tag`.`type`",
|
||||
"tid" => "`post-tag`.`tid`",
|
||||
"cid" => "`post-tag`.`cid`",
|
||||
"name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
|
||||
"url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END"],
|
||||
"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`"
|
||||
]
|
||||
];
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue