]> git.mxchange.org Git - friendica.git/commitdiff
[Database version 1489] Add new report database tables
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 12 Nov 2022 21:50:28 +0000 (16:50 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 14 Nov 2022 17:10:37 +0000 (12:10 -0500)
database.sql
doc/database.md
doc/database/db_report-post.md [new file with mode: 0644]
doc/database/db_report.md [new file with mode: 0644]
static/dbstructure.config.php

index 9f96b7bbf3207fdf7823ac047b7672c087e0e173..71a5f0ae5fe9c9d77ad7ca78bdc7d2e0467c9101 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- 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
 ) 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
 --
index 1ffbf91f5d648cbe5992f8c4522c3ab5c9993f90..4259749d2a003676218620331c70cc2267ff5260 100644 (file)
@@ -74,6 +74,8 @@ Database Tables
 | [profile_field](help/database/db_profile_field) | Custom profile fields |
 | [push_subscriber](help/database/db_push_subscriber) | Used for OStatus: Contains feed subscribers |
 | [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) |  |
 | [session](help/database/db_session) | web session storage |
 | [storage](help/database/db_storage) | Data stored by Database storage backend |
diff --git a/doc/database/db_report-post.md b/doc/database/db_report-post.md
new file mode 100644 (file)
index 0000000..303aa32
--- /dev/null
@@ -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)
diff --git a/doc/database/db_report.md b/doc/database/db_report.md
new file mode 100644 (file)
index 0000000..6e52636
--- /dev/null
@@ -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)
index 343cf30206d8ddc9fcfa779994cf3055626d920e..17064fd959aef19f908b2f8dbadd43d15ddc82b7 100644 (file)
@@ -55,7 +55,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1488);
+       define('DB_UPDATE_VERSION', 1489);
 }
 
 return [
@@ -1649,6 +1649,33 @@ return [
                        "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" => [
                "comment" => "",
                "fields" => [