]> git.mxchange.org Git - friendica.git/blobdiff - static/dbstructure.config.php
Merge pull request #9887 from MrPetovan/task/9872-normalize-frontend-api-responses
[friendica.git] / static / dbstructure.config.php
index 5e57d250f3ea8c8827d6e9e9c216399c4338ce26..d0c35e4f8d491ac3e6c055e8ee32cf720202907b 100644 (file)
@@ -55,7 +55,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1377);
+       define('DB_UPDATE_VERSION', 1396);
 }
 
 return [
@@ -75,19 +75,22 @@ return [
                        "poco" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
                        "noscrape" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
                        "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
+                       "protocol" => ["type" => "tinyint unsigned", "comment" => "The protocol of the server"],
                        "platform" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
                        "relay-subscribe" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Has the server subscribed to the relay system"],
                        "relay-scope" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => "The scope of messages that the server wants to get"],
                        "detection-method" => ["type" => "tinyint unsigned", "comment" => "Method that had been used to detect that server"],
                        "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
                        "last_poco_query" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
-                       "last_contact" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
-                       "last_failure" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
+                       "last_contact" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => "Last successful connection request"],
+                       "last_failure" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => "Last failed connection request"],
                        "failed" => ["type" => "boolean", "comment" => "Connection failed"],
+                       "next_contact" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => "Next connection request"],
                ],
                "indexes" => [
                        "PRIMARY" => ["id"],
                        "nurl" => ["UNIQUE", "nurl(190)"],
+                       "next_contact" => ["next_contact"],
                ]
        ],
        "user" => [
@@ -307,6 +310,16 @@ return [
                        "uid_allow_cid_allow_gid_deny_cid_deny_gid" => ["uid", "allow_cid(50)", "allow_gid(30)", "deny_cid(50)", "deny_gid(30)"],
                ]
        ],
+       "verb" => [
+               "comment" => "Activity Verbs",
+               "fields" => [
+                       "id" => ["type" => "smallint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
+                       "name" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""]
+               ],
+               "indexes" => [
+                       "PRIMARY" => ["id"]
+               ]
+       ],
        // Main tables
        "2fa_app_specific_password" => [
                "comment" => "Two-factor app-specific _password",
@@ -335,6 +348,20 @@ return [
                        "PRIMARY" => ["uid", "code"]
                ]
        ],
+       "2fa_trusted_browser" => [
+               "comment" => "Two-factor authentication trusted browsers",
+               "fields" => [
+                       "cookie_hash" => ["type" => "varchar(80)", "not null" => "1", "primary" => "1", "comment" => "Trusted cookie hash"],
+                       "uid" => ["type" => "mediumint unsigned", "not null" => "1", "foreign" => ["user" => "uid"], "comment" => "User ID"],
+                       "user_agent" => ["type" => "text", "comment" => "User agent string"],
+                       "created" => ["type" => "datetime", "not null" => "1", "comment" => "Datetime the trusted browser was recorded"],
+                       "last_used" => ["type" => "datetime", "comment" => "Datetime the trusted browser was last used"],
+               ],
+               "indexes" => [
+                       "PRIMARY" => ["cookie_hash"],
+                       "uid" => ["uid"],
+               ]
+       ],
        "addon" => [
                "comment" => "registered addons",
                "fields" => [
@@ -385,6 +412,7 @@ return [
                        "alias" => ["alias(190)"],
                        "followers" => ["followers(190)"],
                        "baseurl" => ["baseurl(190)"],
+                       "sharedinbox" => ["sharedinbox(190)"],
                        "gsid" => ["gsid"]
                ]
        ],
@@ -516,6 +544,19 @@ return [
                        "received" => ["received"],
                ]
        ],
+       "delayed-post" => [
+               "comment" => "Posts that are about to be distributed at a later time",
+               "fields" => [
+                       "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
+                       "uri" => ["type" => "varchar(255)", "comment" => "URI of the post that will be distributed later"],
+                       "uid" => ["type" => "mediumint unsigned", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
+                       "delayed" => ["type" => "datetime", "comment" => "delay time"],
+               ],
+               "indexes" => [
+                       "PRIMARY" => ["id"],
+                       "uid_uri" => ["UNIQUE", "uid", "uri(190)"],
+               ]
+       ],
        "diaspora-interaction" => [
                "comment" => "Signed Diaspora Interaction",
                "fields" => [
@@ -725,8 +766,7 @@ return [
                        "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the owner of this item"],
                        "author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the author of this item"],
                        "causer-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the contact that caused the item creation"],
-                       "icid" => ["type" => "int unsigned", "relation" => ["item-content" => "id"], "comment" => "Id of the item-content table entry that contains the whole item content"],
-                       "vid" => ["type" => "mediumint unsigned", "foreign" => ["verb" => "id", "on delete" => "restrict"], "comment" => "Id of the verb table entry that contains the activity verbs"],
+                       "vid" => ["type" => "smallint unsigned", "foreign" => ["verb" => "id", "on delete" => "restrict"], "comment" => "Id of the verb table entry that contains the activity verbs"],
                        "extid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
                        "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
                        "global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
@@ -750,6 +790,7 @@ return [
                        "event-id" => ["type" => "int unsigned", "relation" => ["event" => "id"], "comment" => "Used to link to the event.id"],
                        // Deprecated fields. Will be removed in upcoming versions
                        "iaid" => ["type" => "int unsigned", "comment" => "Deprecated"],
+                       "icid" => ["type" => "int unsigned", "comment" => "Deprecated"],
                        "attach" => ["type" => "mediumtext", "comment" => "Deprecated"],
                        "allow_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
                        "allow_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
@@ -809,8 +850,6 @@ return [
                        "uid_unseen_wall" => ["uid", "unseen", "wall"],
                        "mention_uid_id" => ["mention", "uid", "id"],
                        "uid_eventid" => ["uid", "event-id"],
-                       "icid" => ["icid"],
-                       "iaid" => ["iaid"],
                        "vid" => ["vid"],
                        "psid_wall" => ["psid", "wall"],
                        "uri-id" => ["uri-id"],
@@ -819,55 +858,6 @@ return [
                        "causer-id" => ["causer-id"],
                ]
        ],
-       "item-activity" => [
-               "comment" => "Activities for items",
-               "fields" => [
-                       "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
-                       "uri" => ["type" => "varchar(255)", "comment" => ""],
-                       "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
-                       "uri-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
-                       "activity" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""]
-               ],
-               "indexes" => [
-                       "PRIMARY" => ["id"],
-                       "uri-hash" => ["UNIQUE", "uri-hash"],
-                       "uri" => ["uri(191)"],
-                       "uri-id" => ["uri-id"]
-               ]
-       ],
-       "item-content" => [
-               "comment" => "Content for all posts",
-               "fields" => [
-                       "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
-                       "uri" => ["type" => "varchar(255)", "comment" => ""],
-                       "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
-                       "uri-plink-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
-                       "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "item title"],
-                       "content-warning" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
-                       "body" => ["type" => "mediumtext", "comment" => "item body content"],
-                       "raw-body" => ["type" => "mediumtext", "comment" => "Body without embedded media links"],
-                       "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "text location where this item originated"],
-                       "coord" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "longitude/latitude pair representing location where this item originated"],
-                       "language" => ["type" => "text", "comment" => "Language information about this post"],
-                       "app" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "application which generated this item"],
-                       "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
-                       "rendered-html" => ["type" => "mediumtext", "comment" => "item.body converted to html"],
-                       "object-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams object type"],
-                       "object" => ["type" => "text", "comment" => "JSON encoded object structure unless it is an implied object (normal post)"],
-                       "target-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams target type if applicable (URI)"],
-                       "target" => ["type" => "text", "comment" => "JSON encoded target structure if used"],
-                       "plink" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "permalink or URL to a displayable copy of the message at its source"],
-                       "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams verb"]
-               ],
-               "indexes" => [
-                       "PRIMARY" => ["id"],
-                       "uri-plink-hash" => ["UNIQUE", "uri-plink-hash"],
-                       "title-content-warning-body" => ["FULLTEXT", "title", "content-warning", "body"],
-                       "uri" => ["uri(191)"],
-                       "plink" => ["plink(191)"],
-                       "uri-id" => ["uri-id"]
-               ]
-       ],
        "locks" => [
                "comment" => "",
                "fields" => [
@@ -1071,10 +1061,11 @@ return [
                "comment" => "photo storage",
                "fields" => [
                        "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
-                       "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
+                       "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid", "on delete" => "restrict"], "comment" => "Owner User id"],
                        "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "contact.id"],
                        "guid" => ["type" => "char(16)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this photo"],
                        "resource-id" => ["type" => "char(32)", "not null" => "1", "default" => "", "comment" => ""],
+                       "hash" => ["type" => "char(32)", "comment" => "hash value of the photo"],
                        "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation date"],
                        "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edited date"],
                        "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
@@ -1121,6 +1112,33 @@ return [
                        "uid" => ["uid"],
                ]
        ],
+       "post-content" => [
+               "comment" => "Content for all posts",
+               "fields" => [
+                       "uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
+                       "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "item title"],
+                       "content-warning" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
+                       "body" => ["type" => "mediumtext", "comment" => "item body content"],
+                       "raw-body" => ["type" => "mediumtext", "comment" => "Body without embedded media links"],
+                       "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "text location where this item originated"],
+                       "coord" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "longitude/latitude pair representing location where this item originated"],
+                       "language" => ["type" => "text", "comment" => "Language information about this post"],
+                       "app" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "application which generated this item"],
+                       "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
+                       "rendered-html" => ["type" => "mediumtext", "comment" => "item.body converted to html"],
+                       "object-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams object type"],
+                       "object" => ["type" => "text", "comment" => "JSON encoded object structure unless it is an implied object (normal post)"],
+                       "target-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams target type if applicable (URI)"],
+                       "target" => ["type" => "text", "comment" => "JSON encoded target structure if used"],
+                       "resource-id" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type"],
+                       "plink" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "permalink or URL to a displayable copy of the message at its source"]
+               ],
+               "indexes" => [
+                       "PRIMARY" => ["uri-id"],
+                       "plink" => ["plink(191)"],
+                       "title-content-warning-body" => ["FULLTEXT", "title", "content-warning", "body"],
+               ]
+       ],
        "post-delivery-data" => [
                "comment" => "Delivery data for items",
                "fields" => [
@@ -1178,8 +1196,10 @@ return [
        "post-user" => [
                "comment" => "User specific post data",
                "fields" => [
-                       "uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
-                       "uid" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "Owner id which owns this copy of the item"],
+                       "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
+                       "uri-id" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
+                       "uid" => ["type" => "mediumint unsigned", "not null" => "1", "foreign" => ["user" => "uid"], "comment" => "Owner id which owns this copy of the item"],
+                       "protocol" => ["type" => "tinyint unsigned", "comment" => "Protocol used to deliver the item for this user"],
                        "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id"],
                        "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "post has not been seen"],
                        "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide the post from the user"],
@@ -1188,7 +1208,8 @@ return [
                        "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this post"],
                ],
                "indexes" => [
-                       "PRIMARY" => ["uid", "uri-id"],
+                       "PRIMARY" => ["id"],
+                       "uid_uri-id" => ["UNIQUE", "uid", "uri-id"],
                        "uri-id" => ["uri-id"],
                        "contact-id" => ["contact-id"],
                        "psid" => ["psid"],
@@ -1469,16 +1490,6 @@ return [
                        "iid_uid" => ["iid", "uid"]
                ]
        ],
-       "verb" => [
-               "comment" => "Activity Verbs",
-               "fields" => [
-                       "id" => ["type" => "mediumint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
-                       "name" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""]
-               ],
-               "indexes" => [
-                       "PRIMARY" => ["id"]
-               ]
-       ],
        "worker-ipc" => [
                "comment" => "Inter process communication between the frontend and the worker",
                "fields" => [
@@ -1494,7 +1505,8 @@ return [
                "comment" => "Background tasks queue entries",
                "fields" => [
                        "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented worker task id"],
-                       "parameter" => ["type" => "mediumtext", "comment" => "Task command"],
+                       "command" => ["type" => "varchar(100)", "comment" => "Task command"],
+                       "parameter" => ["type" => "mediumtext", "comment" => "Task parameter"],
                        "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Task priority"],
                        "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date"],
                        "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process id of the worker"],
@@ -1505,7 +1517,8 @@ return [
                ],
                "indexes" => [
                        "PRIMARY" => ["id"],
-                       "done_parameter" => ["done", "parameter(64)"],
+                       "command" => ["command"],
+                       "done_command_parameter" => ["done", "command", "parameter(64)"],
                        "done_executed" => ["done", "executed"],
                        "done_priority_retrial_created" => ["done", "priority", "retrial", "created"],
                        "done_priority_next_try" => ["done", "priority", "next_try"],