friendica/static/dbstructure.config.php

1537 lines
98 KiB
PHP
Raw Normal View History

<?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 database structure configuration file.
*
* Here are described all the tables, fields and indexes Friendica needs to work.
2020-11-18 00:45:16 +01:00
* The entry order is mostly alphabetic - with the exception of tables that are used in foreign keys.
*
* Syntax (braces indicate optionale values):
* "<table name>" => [
* "comment" => "Description of the table",
* "fields" => [
* "<field name>" => [
* "type" => "<field type>{(<field size>)} <unsigned>",
* "not null" => 0|1,
* {"extra" => "auto_increment",}
* {"default" => "<default value>",}
* {"default" => NULL_DATE,} (for datetime fields)
* {"primary" => "1",}
2020-05-10 16:55:03 +02:00
* {"foreign|relation" => ["<foreign key table name>" => "<foreign key field name>"],}
* "comment" => "Description of the fields"
* ],
* ...
* ],
* "indexes" => [
* "PRIMARY" => ["<primary key field name>", ...],
* "<index name>" => [{"UNIQUE",} "<field name>{(<key size>)}", ...]
* ...
* ],
* ],
*
2020-05-10 16:55:03 +02:00
* Whenever possible prefer "foreign" before "relation" with the foreign keys.
* "foreign" adds true foreign keys on the database level, while "relation" simulates this behaviour.
*
* If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value below.
*
*/
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
2021-01-20 00:26:24 +01:00
define('DB_UPDATE_VERSION', 1393);
}
return [
2020-05-15 14:17:13 +02:00
// Side tables
2020-05-22 07:06:55 +02:00
"gserver" => [
"comment" => "Global servers",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
"url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"version" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"site_name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"info" => ["type" => "text", "comment" => ""],
"register_policy" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
"registered-users" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Number of registered users"],
"directory-type" => ["type" => "tinyint", "default" => "0", "comment" => "Type of directory service (Poco, Mastodon)"],
"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" => ""],
2021-01-09 20:18:22 +01:00
"protocol" => ["type" => "tinyint unsigned", "comment" => "The protocol of the server"],
2020-05-22 07:06:55 +02:00
"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" => ""],
2020-12-03 16:47:50 +01:00
"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"],
2020-12-03 16:47:50 +01:00
"next_contact" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => "Next connection request"],
2020-05-22 07:06:55 +02:00
],
"indexes" => [
"PRIMARY" => ["id"],
"nurl" => ["UNIQUE", "nurl(190)"],
2020-12-03 16:47:50 +01:00
"next_contact" => ["next_contact"],
2020-05-22 07:06:55 +02:00
]
],
2020-11-17 23:49:55 +01:00
"user" => [
"comment" => "The local users",
"fields" => [
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
2020-11-18 01:31:05 +01:00
"parent-uid" => ["type" => "mediumint unsigned", "foreign" => ["user" => "uid"],
2020-11-17 23:49:55 +01:00
"comment" => "The parent user that has full control about this user"],
"guid" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this user"],
"username" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name that this user is known by"],
"password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "encrypted password"],
"legacy_password" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is the password hash double-hashed?"],
"nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "nick- and user name"],
"email" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "the users email address"],
"openid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"timezone" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => "PHP-legal timezone"],
"language" => ["type" => "varchar(32)", "not null" => "1", "default" => "en", "comment" => "default language"],
"register_date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of registration"],
"login_date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of last login"],
"default-location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Default for item.location"],
"allow_location" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 allows to display the location"],
"theme" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "user theme preference"],
"pubkey" => ["type" => "text", "comment" => "RSA public key 4096 bit"],
"prvkey" => ["type" => "text", "comment" => "RSA private key 4096 bit"],
"spubkey" => ["type" => "text", "comment" => ""],
"sprvkey" => ["type" => "text", "comment" => ""],
"verified" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "user is verified through email"],
"blocked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 for user is blocked"],
"blockwall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to post to the profile page of the user"],
"hidewall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide profile details from unkown viewers"],
"blocktags" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to tag the post of this user"],
"unkmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Permit unknown people to send private mails to this user"],
"cntunkmail" => ["type" => "int unsigned", "not null" => "1", "default" => "10", "comment" => ""],
"notify-flags" => ["type" => "smallint unsigned", "not null" => "1", "default" => "65535", "comment" => "email notification options"],
"page-flags" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "page/profile type"],
"account-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
"prvnets" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"pwdreset" => ["type" => "varchar(255)", "comment" => "Password reset request token"],
"pwdreset_time" => ["type" => "datetime", "comment" => "Timestamp of the last password reset request"],
"maxreq" => ["type" => "int unsigned", "not null" => "1", "default" => "10", "comment" => ""],
"expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
"account_removed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if 1 the account is removed"],
"account_expired" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"account_expires_on" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp when account expires and will be deleted"],
"expire_notification_sent" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of last warning of account expiration"],
"def_gid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
"allow_cid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
"allow_gid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
"deny_cid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
"deny_gid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
"openidserver" => ["type" => "text", "comment" => ""],
],
"indexes" => [
"PRIMARY" => ["uid"],
"nickname" => ["nickname(32)"],
"parent-uid" => ["parent-uid"],
]
],
2020-05-15 14:17:13 +02:00
"contact" => [
"comment" => "contact table",
"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"],
2020-05-15 14:17:13 +02:00
"created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
"updated" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => "Date of last contact update"],
"self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 if the contact is the user him/her self"],
"remote_self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"rel" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "The kind of the relation between the user and the contact"],
"duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network of the contact"],
"protocol" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Protocol of the contact"],
"name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name that this contact is known by"],
"nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Nick- and user name of the contact"],
"location" => ["type" => "varchar(255)", "default" => "", "comment" => ""],
"about" => ["type" => "text", "comment" => ""],
"keywords" => ["type" => "text", "comment" => "public keywords (interests) of the contact"],
"gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Deprecated"],
"xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"attag" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"photo" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo of the contact"],
"thumb" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo (thumb size)"],
"micro" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo (micro size)"],
"site-pubkey" => ["type" => "text", "comment" => ""],
"issued-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"pubkey" => ["type" => "text", "comment" => "RSA public key 4096 bit"],
"prvkey" => ["type" => "text", "comment" => "RSA private key 4096 bit"],
"batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"request" => ["type" => "varchar(255)", "comment" => ""],
"notify" => ["type" => "varchar(255)", "comment" => ""],
"poll" => ["type" => "varchar(255)", "comment" => ""],
"confirm" => ["type" => "varchar(255)", "comment" => ""],
"subscribe" => ["type" => "varchar(255)", "comment" => ""],
2020-05-15 14:17:13 +02:00
"poco" => ["type" => "varchar(255)", "comment" => ""],
"aes_allow" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"ret-aes" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"usehub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"subhub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"hub-verify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"last-update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last try to update the contact info"],
"success_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last successful contact update"],
"failure_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last failed update"],
"failed" => ["type" => "boolean", "comment" => "Connection failed"],
2020-05-15 14:17:13 +02:00
"name-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
"uri-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
"avatar-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
"term-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
"last-item" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "date of the last post"],
2020-07-26 09:34:33 +02:00
"last-discovery" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "date of the last follower discovery"],
2020-05-15 14:17:13 +02:00
"priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
"blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "Node-wide block status"],
"block_reason" => ["type" => "text", "comment" => "Node-wide block reason"],
"readonly" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "posts of the contact are readonly"],
"writable" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"forum" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "contact is a forum"],
"prv" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "contact is a private group"],
"contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
"manually-approve" => ["type" => "boolean", "comment" => ""],
2020-05-15 14:17:13 +02:00
"hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"archive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"pending" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
"deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact has been deleted"],
"rating" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
"unsearchable" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact prefers to not be searchable"],
"sensitive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact posts sensitive content"],
"baseurl" => ["type" => "varchar(255)", "default" => "", "comment" => "baseurl of the contact"],
"gsid" => ["type" => "int unsigned", "foreign" => ["gserver" => "id", "on delete" => "restrict"], "comment" => "Global Server ID"],
2020-05-15 14:17:13 +02:00
"reason" => ["type" => "text", "comment" => ""],
"closeness" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "99", "comment" => ""],
"info" => ["type" => "mediumtext", "comment" => ""],
"profile-id" => ["type" => "int unsigned", "comment" => "Deprecated"],
"bdyear" => ["type" => "varchar(4)", "not null" => "1", "default" => "", "comment" => ""],
"bd" => ["type" => "date", "not null" => "1", "default" => DBA::NULL_DATE, "comment" => ""],
"notify_new_posts" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"fetch_further_information" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
"ffi_keyword_denylist" => ["type" => "text", "comment" => ""],
2020-05-15 14:17:13 +02:00
],
"indexes" => [
"PRIMARY" => ["id"],
"uid_name" => ["uid", "name(190)"],
"self_uid" => ["self", "uid"],
2020-11-19 10:47:59 +01:00
"alias_uid" => ["alias(128)", "uid"],
2020-05-15 14:17:13 +02:00
"pending_uid" => ["pending", "uid"],
"blocked_uid" => ["blocked", "uid"],
"uid_rel_network_poll" => ["uid", "rel", "network", "poll(64)", "archive"],
"uid_network_batch" => ["uid", "network", "batch(64)"],
2020-11-19 10:47:59 +01:00
"addr_uid" => ["addr(128)", "uid"],
"nurl_uid" => ["nurl(128)", "uid"],
"nick_uid" => ["nick(128)", "uid"],
"attag_uid" => ["attag(96)", "uid"],
2020-05-15 14:17:13 +02:00
"dfrn-id" => ["dfrn-id(64)"],
"issued-id" => ["issued-id(64)"],
2020-07-18 17:49:10 +02:00
"network_uid_lastupdate" => ["network", "uid", "last-update"],
"uid_network_self_lastupdate" => ["uid", "network", "self", "last-update"],
2020-08-16 13:57:56 +02:00
"uid_lastitem" => ["uid", "last-item"],
"gsid" => ["gsid"]
2020-05-15 14:17:13 +02:00
]
],
"item-uri" => [
"comment" => "URI and GUID for items",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
"uri" => ["type" => "varbinary(255)", "not null" => "1", "comment" => "URI of an item"],
"guid" => ["type" => "varbinary(255)", "comment" => "A unique identifier for an item"]
],
"indexes" => [
"PRIMARY" => ["id"],
"uri" => ["UNIQUE", "uri"],
"guid" => ["guid"]
]
],
2020-08-24 22:06:06 +02:00
"tag" => [
"comment" => "tags and mentions",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
"name" => ["type" => "varchar(96)", "not null" => "1", "default" => "", "comment" => ""],
"url" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""]
],
"indexes" => [
"PRIMARY" => ["id"],
"type_name_url" => ["UNIQUE", "name", "url"],
"url" => ["url"]
]
],
"clients" => [
"comment" => "OAuth usage",
"fields" => [
"client_id" => ["type" => "varchar(20)", "not null" => "1", "primary" => "1", "comment" => ""],
"pw" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => ""],
"redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
"name" => ["type" => "text", "comment" => ""],
"icon" => ["type" => "text", "comment" => ""],
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
],
"indexes" => [
"PRIMARY" => ["client_id"],
"uid" => ["uid"],
]
],
2020-05-15 14:17:13 +02:00
"permissionset" => [
"comment" => "",
"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 id of this permission set"],
2020-05-15 14:17:13 +02:00
"allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
"allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
"deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
"deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
],
"indexes" => [
"PRIMARY" => ["id"],
"uid_allow_cid_allow_gid_deny_cid_deny_gid" => ["uid", "allow_cid(50)", "allow_gid(30)", "deny_cid(50)", "deny_gid(30)"],
2020-05-15 14:17:13 +02:00
]
],
2020-11-20 01:17:32 +01:00
"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"]
]
],
2020-05-15 14:17:13 +02:00
// Main tables
"2fa_app_specific_password" => [
"comment" => "Two-factor app-specific _password",
"fields" => [
"id" => ["type" => "mediumint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Password ID for revocation"],
2020-08-24 22:06:06 +02:00
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "foreign" => ["user" => "uid"], "comment" => "User ID"],
"description" => ["type" => "varchar(255)", "comment" => "Description of the usage of the password"],
2019-08-21 08:18:32 +02:00
"hashed_password" => ["type" => "varchar(255)", "not null" => "1", "comment" => "Hashed password"],
"generated" => ["type" => "datetime", "not null" => "1", "comment" => "Datetime the password was generated"],
"last_used" => ["type" => "datetime", "comment" => "Datetime the password was last used"],
],
"indexes" => [
"PRIMARY" => ["id"],
2019-08-21 08:18:32 +02:00
"uid_description" => ["uid", "description(190)"],
]
],
"2fa_recovery_codes" => [
"comment" => "Two-factor authentication recovery codes",
"fields" => [
2020-08-24 22:06:06 +02:00
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User ID"],
"code" => ["type" => "varchar(50)", "not null" => "1", "primary" => "1", "comment" => "Recovery code string"],
"generated" => ["type" => "datetime", "not null" => "1", "comment" => "Datetime the code was generated"],
"used" => ["type" => "datetime", "comment" => "Datetime the code was used"],
],
"indexes" => [
"PRIMARY" => ["uid", "code"]
]
],
"addon" => [
"comment" => "registered addons",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
"name" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "addon base (file)name"],
"version" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "currently unused"],
"installed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "currently always 1"],
"hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "currently unused"],
"timestamp" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "file timestamp to check for reloads"],
"plugin_admin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 = has admin config, 0 = has no admin config"],
],
"indexes" => [
"PRIMARY" => ["id"],
"name" => ["UNIQUE", "name"],
]
],
"apcontact" => [
"comment" => "ActivityPub compatible contacts - used in the ActivityPub implementation",
"fields" => [
"url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "URL of the contact"],
"uuid" => ["type" => "varchar(255)", "comment" => ""],
"type" => ["type" => "varchar(20)", "not null" => "1", "comment" => ""],
"following" => ["type" => "varchar(255)", "comment" => ""],
"followers" => ["type" => "varchar(255)", "comment" => ""],
"inbox" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
"outbox" => ["type" => "varchar(255)", "comment" => ""],
"sharedinbox" => ["type" => "varchar(255)", "comment" => ""],
"manually-approve" => ["type" => "boolean", "comment" => ""],
"nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"name" => ["type" => "varchar(255)", "comment" => ""],
"about" => ["type" => "text", "comment" => ""],
"photo" => ["type" => "varchar(255)", "comment" => ""],
"addr" => ["type" => "varchar(255)", "comment" => ""],
"alias" => ["type" => "varchar(255)", "comment" => ""],
"pubkey" => ["type" => "text", "comment" => ""],
2020-06-04 23:55:14 +02:00
"subscribe" => ["type" => "varchar(255)", "comment" => ""],
"baseurl" => ["type" => "varchar(255)", "comment" => "baseurl of the ap contact"],
"gsid" => ["type" => "int unsigned", "foreign" => ["gserver" => "id", "on delete" => "restrict"], "comment" => "Global Server ID"],
"generator" => ["type" => "varchar(255)", "comment" => "Name of the contact's system"],
"following_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of following contacts"],
"followers_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of followers"],
"statuses_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of posts"],
"updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
],
"indexes" => [
"PRIMARY" => ["url"],
"addr" => ["addr(32)"],
"alias" => ["alias(190)"],
"followers" => ["followers(190)"],
2020-07-18 17:49:10 +02:00
"baseurl" => ["baseurl(190)"],
2020-11-23 20:25:22 +01:00
"sharedinbox" => ["sharedinbox(190)"],
"gsid" => ["gsid"]
]
],
"attach" => [
"comment" => "file attachments",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "generated index"],
2020-08-24 22:06:06 +02:00
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
"hash" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "hash"],
"filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "filename of original"],
"filetype" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "mimetype"],
"filesize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "size in bytes"],
"data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"],
"created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
"edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
"allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>"],
"allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
"deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
"deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
"backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"],
"backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"],
],
"indexes" => [
"PRIMARY" => ["id"],
2020-08-24 22:06:06 +02:00
"uid" => ["uid"],
]
],
"auth_codes" => [
"comment" => "OAuth usage",
"fields" => [
"id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
2020-05-10 16:55:03 +02:00
"client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "foreign" => ["clients" => "client_id"],
"comment" => ""],
"redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
"expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
"scope" => ["type" => "varchar(250)", "not null" => "1", "default" => "", "comment" => ""],
],
"indexes" => [
"PRIMARY" => ["id"],
2020-05-10 16:55:03 +02:00
"client_id" => ["client_id"]
]
],
"cache" => [
"comment" => "Stores temporary data",
"fields" => [
"k" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "cache key"],
"v" => ["type" => "mediumtext", "comment" => "cached serialized value"],
"expires" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache expiration"],
"updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache insertion"],
],
"indexes" => [
"PRIMARY" => ["k"],
"k_expires" => ["k", "expires"],
]
],
"challenge" => [
"comment" => "",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
"challenge" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
"type" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"last_update" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
],
"indexes" => [
"PRIMARY" => ["id"],
]
],
"config" => [
"comment" => "main configuration storage",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
"cat" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
"k" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
"v" => ["type" => "mediumtext", "comment" => ""],
],
"indexes" => [
"PRIMARY" => ["id"],
"cat_k" => ["UNIQUE", "cat", "k"],
]
],
2020-03-10 22:10:59 +01:00
"contact-relation" => [
"comment" => "Contact relations",
"fields" => [
2020-07-26 09:34:33 +02:00
"cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "primary" => "1", "comment" => "contact the related contact had interacted with"],
"relation-cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "primary" => "1", "comment" => "related contact who had interacted with the contact"],
2020-03-10 23:04:03 +01:00
"last-interaction" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last interaction"],
2020-07-26 09:34:33 +02:00
"follow-updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last update of the contact relationship"],
"follows" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
2020-03-10 22:10:59 +01:00
],
"indexes" => [
"PRIMARY" => ["cid", "relation-cid"],
"relation-cid" => ["relation-cid"],
]
],
"conv" => [
"comment" => "private messages",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
"guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this conversation"],
"recips" => ["type" => "text", "comment" => "sender_handle;recipient_handle"],
2020-08-24 22:06:06 +02:00
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
"creator" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "handle of creator"],
"created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation timestamp"],
"updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "edited timestamp"],
"subject" => ["type" => "text", "comment" => "subject of initial message"],
],
"indexes" => [
"PRIMARY" => ["id"],
"uid" => ["uid"],
]
],
"conversation" => [
"comment" => "Raw data and structure information for messages",
"fields" => [
"item-uri" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "Original URI of the item - unrelated to the table with the same name"],
"reply-to-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "URI to which this item is a reply"],
"conversation-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation URI"],
"conversation-href" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation link"],
"protocol" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "255", "comment" => "The protocol of the item"],
"direction" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "How the message arrived here: 1=push, 2=pull"],
"source" => ["type" => "mediumtext", "comment" => "Original source"],
"received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Receiving date"],
],
"indexes" => [
"PRIMARY" => ["item-uri"],
"conversation-uri" => ["conversation-uri"],
"received" => ["received"],
]
],
2020-12-01 23:11:29 +01:00
"delayed-post" => [
2020-12-02 15:55:57 +01:00
"comment" => "Posts that are about to be distributed at a later time",
2020-12-01 23:11:29 +01:00
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
2020-12-02 15:55:57 +01:00
"uri" => ["type" => "varchar(255)", "comment" => "URI of the post that will be distributed later"],
2020-12-01 23:11:29 +01:00
"uid" => ["type" => "mediumint unsigned", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
"delayed" => ["type" => "datetime", "comment" => "delay time"],
],
"indexes" => [
"PRIMARY" => ["id"],
2020-12-02 01:34:10 +01:00
"uid_uri" => ["UNIQUE", "uid", "uri(190)"],
2020-12-01 23:11:29 +01:00
]
],
"diaspora-interaction" => [
"comment" => "Signed Diaspora Interaction",
"fields" => [
2020-05-10 16:55:03 +02:00
"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"],
"interaction" => ["type" => "mediumtext", "comment" => "The Diaspora interaction"]
],
"indexes" => [
"PRIMARY" => ["uri-id"]
]
],
"event" => [
"comment" => "Events",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
"guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
2020-08-24 22:06:06 +02:00
"cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact_id (ID of the contact in contact table)"],
"uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
"edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
"start" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "event start time"],
"finish" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "event end time"],
"summary" => ["type" => "text", "comment" => "short description or title of the event"],
"desc" => ["type" => "text", "comment" => "event description"],
"location" => ["type" => "text", "comment" => "event location"],
"type" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => "event or birthday"],
"nofinish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if event does have no end this is 1"],
"adjust" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "adjust to timezone of the recipient (0 or 1)"],
"ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "0 or 1"],
"allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
"allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
"deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
"deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
],
"indexes" => [
"PRIMARY" => ["id"],
"uid_start" => ["uid", "start"],
2020-08-24 22:06:06 +02:00
"cid" => ["cid"],
]
],
"fcontact" => [
"comment" => "Diaspora compatible contacts - used in the Diaspora implementation",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
"guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "unique id"],
"url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"notify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"poll" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"confirm" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
"network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
"alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"pubkey" => ["type" => "text", "comment" => ""],
"updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
],
"indexes" => [
"PRIMARY" => ["id"],
"addr" => ["addr(32)"],
"url" => ["UNIQUE", "url(190)"],
]
],
"fsuggest" => [
"comment" => "friend suggestion stuff",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
2020-08-24 22:06:06 +02:00
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
"cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
"name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"note" => ["type" => "text", "comment" => ""],
"created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
],
"indexes" => [
"PRIMARY" => ["id"],
2020-08-24 22:06:06 +02:00
"cid" => ["cid"],
"uid" => ["uid"],
]
],
"group" => [
"comment" => "privacy groups, group info",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
2020-08-24 22:06:06 +02:00
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
"visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the member list is not private"],
"deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the group has been deleted"],
"name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "human readable name of group"],
],
"indexes" => [
"PRIMARY" => ["id"],
"uid" => ["uid"],
]
],
"group_member" => [
"comment" => "privacy groups, member info",
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
2020-08-24 22:06:06 +02:00
"gid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["group" => "id"], "comment" => "groups.id of the associated group"],
"contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id of the member assigned to the associated group"],
],
"indexes" => [
"PRIMARY" => ["id"],
"contactid" => ["contact-id"],
"gid_contactid" => ["UNIQUE", "gid", "contact-id"],
]
],
"gserver-tag" => [
"comment" => "Tags that the server has subscribed",
"fields" => [
2020-08-24 22:06:06 +02:00