mirror of
https://github.com/friendica/friendica
synced 2024-11-09 17:02:54 +00:00
[Database version 1489] Add new report database tables
This commit is contained in:
parent
e6db31a462
commit
5d9ce80007
5 changed files with 125 additions and 2 deletions
31
database.sql
31
database.sql
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 2022.12-dev (Giant Rhubarb)
|
-- Friendica 2022.12-dev (Giant Rhubarb)
|
||||||
-- DB_UPDATE_VERSION 1488
|
-- DB_UPDATE_VERSION 1489
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -1646,6 +1646,35 @@ CREATE TABLE IF NOT EXISTS `register` (
|
||||||
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
|
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
|
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
|
||||||
|
|
||||||
|
--
|
||||||
|
-- TABLE report
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS `report` (
|
||||||
|
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
|
||||||
|
`uid` mediumint unsigned NOT NULL COMMENT 'Reporting user',
|
||||||
|
`cid` int unsigned NOT NULL COMMENT 'Reported contact',
|
||||||
|
`comment` text COMMENT 'Report',
|
||||||
|
`forward` boolean COMMENT 'Forward the report to the remote server',
|
||||||
|
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
|
||||||
|
PRIMARY KEY(`id`),
|
||||||
|
INDEX `uid` (`uid`),
|
||||||
|
INDEX `cid` (`cid`),
|
||||||
|
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (`cid`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||||
|
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
|
||||||
|
|
||||||
|
--
|
||||||
|
-- TABLE report-post
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS `report-post` (
|
||||||
|
`rid` int unsigned NOT NULL COMMENT 'Report id',
|
||||||
|
`uri-id` int unsigned NOT NULL COMMENT 'Uri-id of the reported post',
|
||||||
|
PRIMARY KEY(`rid`,`uri-id`),
|
||||||
|
INDEX `uri-id` (`uri-id`),
|
||||||
|
FOREIGN KEY (`rid`) REFERENCES `report` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||||
|
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
|
||||||
|
|
||||||
--
|
--
|
||||||
-- TABLE search
|
-- TABLE search
|
||||||
--
|
--
|
||||||
|
|
|
@ -74,6 +74,8 @@ Database Tables
|
||||||
| [profile_field](help/database/db_profile_field) | Custom profile fields |
|
| [profile_field](help/database/db_profile_field) | Custom profile fields |
|
||||||
| [push_subscriber](help/database/db_push_subscriber) | Used for OStatus: Contains feed subscribers |
|
| [push_subscriber](help/database/db_push_subscriber) | Used for OStatus: Contains feed subscribers |
|
||||||
| [register](help/database/db_register) | registrations requiring admin approval |
|
| [register](help/database/db_register) | registrations requiring admin approval |
|
||||||
|
| [report](help/database/db_report) | |
|
||||||
|
| [report-post](help/database/db_report-post) | |
|
||||||
| [search](help/database/db_search) | |
|
| [search](help/database/db_search) | |
|
||||||
| [session](help/database/db_session) | web session storage |
|
| [session](help/database/db_session) | web session storage |
|
||||||
| [storage](help/database/db_storage) | Data stored by Database storage backend |
|
| [storage](help/database/db_storage) | Data stored by Database storage backend |
|
||||||
|
|
30
doc/database/db_report-post.md
Normal file
30
doc/database/db_report-post.md
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
Table report-post
|
||||||
|
===========
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Fields
|
||||||
|
------
|
||||||
|
|
||||||
|
| Field | Description | Type | Null | Key | Default | Extra |
|
||||||
|
| ------ | --------------------------- | ------------ | ---- | --- | ------- | ----- |
|
||||||
|
| rid | Report id | int unsigned | NO | PRI | NULL | |
|
||||||
|
| uri-id | Uri-id of the reported post | int unsigned | NO | PRI | NULL | |
|
||||||
|
|
||||||
|
Indexes
|
||||||
|
------------
|
||||||
|
|
||||||
|
| Name | Fields |
|
||||||
|
| ------- | ----------- |
|
||||||
|
| PRIMARY | rid, uri-id |
|
||||||
|
| uri-id | uri-id |
|
||||||
|
|
||||||
|
Foreign Keys
|
||||||
|
------------
|
||||||
|
|
||||||
|
| Field | Target Table | Target Field |
|
||||||
|
|-------|--------------|--------------|
|
||||||
|
| rid | [report](help/database/db_report) | id |
|
||||||
|
| uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||||
|
|
||||||
|
Return to [database documentation](help/database)
|
35
doc/database/db_report.md
Normal file
35
doc/database/db_report.md
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
Table report
|
||||||
|
===========
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Fields
|
||||||
|
------
|
||||||
|
|
||||||
|
| Field | Description | Type | Null | Key | Default | Extra |
|
||||||
|
| ------- | --------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
|
||||||
|
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
|
||||||
|
| uid | Reporting user | mediumint unsigned | NO | | NULL | |
|
||||||
|
| cid | Reported contact | int unsigned | NO | | NULL | |
|
||||||
|
| comment | Report | text | YES | | NULL | |
|
||||||
|
| forward | Forward the report to the remote server | boolean | YES | | NULL | |
|
||||||
|
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
|
||||||
|
|
||||||
|
Indexes
|
||||||
|
------------
|
||||||
|
|
||||||
|
| Name | Fields |
|
||||||
|
| ------- | ------ |
|
||||||
|
| PRIMARY | id |
|
||||||
|
| uid | uid |
|
||||||
|
| cid | cid |
|
||||||
|
|
||||||
|
Foreign Keys
|
||||||
|
------------
|
||||||
|
|
||||||
|
| Field | Target Table | Target Field |
|
||||||
|
|-------|--------------|--------------|
|
||||||
|
| uid | [user](help/database/db_user) | uid |
|
||||||
|
| cid | [contact](help/database/db_contact) | id |
|
||||||
|
|
||||||
|
Return to [database documentation](help/database)
|
|
@ -55,7 +55,7 @@
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
if (!defined('DB_UPDATE_VERSION')) {
|
if (!defined('DB_UPDATE_VERSION')) {
|
||||||
define('DB_UPDATE_VERSION', 1488);
|
define('DB_UPDATE_VERSION', 1489);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -1649,6 +1649,33 @@ return [
|
||||||
"uid" => ["uid"],
|
"uid" => ["uid"],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"report" => [
|
||||||
|
"comment" => "",
|
||||||
|
"fields" => [
|
||||||
|
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
|
||||||
|
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "foreign" => ["user" => "uid"], "comment" => "Reporting user"],
|
||||||
|
"cid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["contact" => "id"], "comment" => "Reported contact"],
|
||||||
|
"comment" => ["type" => "text", "comment" => "Report"],
|
||||||
|
"forward" => ["type" => "boolean", "comment" => "Forward the report to the remote server"],
|
||||||
|
"created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
|
||||||
|
],
|
||||||
|
"indexes" => [
|
||||||
|
"PRIMARY" => ["id"],
|
||||||
|
"uid" => ["uid"],
|
||||||
|
"cid" => ["cid"],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"report-post" => [
|
||||||
|
"comment" => "",
|
||||||
|
"fields" => [
|
||||||
|
"rid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["report" => "id"], "comment" => "Report id"],
|
||||||
|
"uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Uri-id of the reported post"],
|
||||||
|
],
|
||||||
|
"indexes" => [
|
||||||
|
"PRIMARY" => ["rid", "uri-id"],
|
||||||
|
"uri-id" => ["uri-id"],
|
||||||
|
]
|
||||||
|
],
|
||||||
"search" => [
|
"search" => [
|
||||||
"comment" => "",
|
"comment" => "",
|
||||||
"fields" => [
|
"fields" => [
|
||||||
|
|
Loading…
Reference in a new issue