1934 lines
125 KiB
PHP
1934 lines
125 KiB
PHP
<?php
|
|
/**
|
|
* @copyright Copyright (C) 2010-2023, the Friendica project
|
|
*
|
|
* @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.
|
|
* 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",}
|
|
* {"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>)}", ...]
|
|
* ...
|
|
* ],
|
|
* ],
|
|
*
|
|
* Whenever possible prefer "foreign" before "relation" with the foreign keys.
|
|
* "foreign" adds true foreign keys on the database level, while "relation" is just an indicator of a table relation without any consequences
|
|
*
|
|
* If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value below.
|
|
*
|
|
*/
|
|
|
|
use Friendica\Database\DBA;
|
|
|
|
// This file is required several times during the test in DbaDefinition which justifies this condition
|
|
if (!defined('DB_UPDATE_VERSION')) {
|
|
define('DB_UPDATE_VERSION', 1535);
|
|
}
|
|
|
|
return [
|
|
// Side tables
|
|
"gserver" => [
|
|
"comment" => "Global servers",
|
|
"fields" => [
|
|
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
|
|
"url" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => ""],
|
|
"nurl" => ["type" => "varbinary(383)", "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"],
|
|
"active-week-users" => ["type" => "int unsigned", "comment" => "Number of active users in the last week"],
|
|
"active-month-users" => ["type" => "int unsigned", "comment" => "Number of active users in the last month"],
|
|
"active-halfyear-users" => ["type" => "int unsigned", "comment" => "Number of active users in the last six month"],
|
|
"local-posts" => ["type" => "int unsigned", "comment" => "Number of local posts"],
|
|
"local-comments" => ["type" => "int unsigned", "comment" => "Number of local comments"],
|
|
"directory-type" => ["type" => "tinyint", "default" => "0", "comment" => "Type of directory service (Poco, Mastodon)"],
|
|
"poco" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => ""],
|
|
"noscrape" => ["type" => "varbinary(383)", "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 successful connection request"],
|
|
"last_failure" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => "Last failed connection request"],
|
|
"blocked" => ["type" => "boolean", "comment" => "Server is blocked"],
|
|
"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"],
|
|
"network" => ["network"],
|
|
]
|
|
],
|
|
"user" => [
|
|
"comment" => "The local users",
|
|
"fields" => [
|
|
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
|
|
"parent-uid" => ["type" => "mediumint unsigned", "foreign" => ["user" => "uid"], "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"],
|
|
"last-activity" => ["type" => "date", "comment" => "Day of the last activity"],
|
|
"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 unknown 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" => "Delay in days before deleting user-related posts. Scope is controlled by pConfig."],
|
|
"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"],
|
|
"guid" => ["guid"],
|
|
"email" => ["email(64)"],
|
|
]
|
|
],
|
|
"user-gserver" => [
|
|
"comment" => "User settings about remote servers",
|
|
"fields" => [
|
|
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "primary" => "1", "comment" => "Owner User id"],
|
|
"gsid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["gserver" => "id"], "primary" => "1", "comment" => "Gserver id"],
|
|
"ignored" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "server accounts are ignored for the user"],
|
|
],
|
|
"indexes" => [
|
|
"PRIMARY" => ["uid", "gsid"],
|
|
"gsid" => ["gsid"]
|
|
],
|
|
],
|
|
"item-uri" => [
|
|
"comment" => "URI and GUID for items",
|
|
"fields" => [
|
|
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
|
|
"uri" => ["type" => "varbinary(383)", "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"]
|
|
]
|
|
],
|
|
"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"],
|
|
"created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
|
|
"updated" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => "Date of last contact update"],
|
|
"network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network 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"],
|
|
"xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "XMPP address"],
|
|
"matrix" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Matrix address"],
|
|
"avatar" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => ""],
|
|
"blurhash" => ["type" => "varbinary(255)", "comment" => "BlurHash representation of the avatar"],
|
|
"header" => ["type" => "varbinary(383)", "comment" => "Header picture"],
|
|
"url" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => ""],
|
|
"nurl" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => ""],
|
|
"uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the contact url"],
|
|
"addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
|
"alias" => ["type" => "varbinary(383)", "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" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => ""],
|
|
"notify" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"poll" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"subscribe" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"last-update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last try to update the contact info"],
|
|
"next-update" => ["type" => "datetime", "comment" => "Next connection request"],
|
|
"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"],
|
|
"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"],
|
|
"last-discovery" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "date of the last follower discovery"],
|
|
"local-data" => ["type" => "boolean", "comment" => "Is true when there are posts with this contact on the system"],
|
|
"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"],
|
|
"contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Person, organisation, news, community, relay"],
|
|
"manually-approve" => ["type" => "boolean", "comment" => "Contact requests have to be approved manually"],
|
|
"archive" => ["type" => "boolean", "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" => "varbinary(383)", "default" => "", "comment" => "baseurl of the contact from the gserver record, can be missing"],
|
|
"gsid" => ["type" => "int unsigned", "foreign" => ["gserver" => "id", "on delete" => "restrict"], "comment" => "Global Server ID, can be missing"],
|
|
"bd" => ["type" => "date", "not null" => "1", "default" => DBA::NULL_DATE, "comment" => ""],
|
|
// User depending fields
|
|
"reason" => ["type" => "text", "comment" => ""],
|
|
"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"],
|
|
"protocol" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Protocol of the contact"],
|
|
"subhub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
|
|
"hub-verify" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => ""],
|
|
"rating" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Automatically detected feed poll frequency"],
|
|
"priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Feed poll priority"],
|
|
"attag" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
|
"hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
|
|
"pending" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "Contact request is pending"],
|
|
"deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact has been deleted"],
|
|
"info" => ["type" => "mediumtext", "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" => ""],
|
|
// Deprecated, but still in use
|
|
"photo" => ["type" => "varbinary(383)", "default" => "", "comment" => "Link to the profile photo of the contact"],
|
|
"thumb" => ["type" => "varbinary(383)", "default" => "", "comment" => "Link to the profile photo (thumb size)"],
|
|
"micro" => ["type" => "varbinary(383)", "default" => "", "comment" => "Link to the profile photo (micro size)"],
|
|
"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" => ""],
|
|
"request" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"confirm" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"poco" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"writable" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
|
|
"forum" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "contact is a group. Deprecated, use 'contact-type' = 'community' and 'manually-approve' = false instead"],
|
|
"prv" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "contact is a private group. Deprecated, use 'contact-type' = 'community' and 'manually-approve' = true instead"],
|
|
"bdyear" => ["type" => "varchar(4)", "not null" => "1", "default" => "", "comment" => ""],
|
|
// Deprecated fields that aren't in use anymore
|
|
"site-pubkey" => ["type" => "text", "comment" => "Deprecated"],
|
|
"gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Deprecated"],
|
|
"duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Deprecated"],
|
|
"issued-id" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => "Deprecated"],
|
|
"dfrn-id" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => "Deprecated"],
|
|
"aes_allow" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Deprecated"],
|
|
"ret-aes" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Deprecated"],
|
|
"usehub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Deprecated"],
|
|
"closeness" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "99", "comment" => "Deprecated"],
|
|
"profile-id" => ["type" => "int unsigned", "comment" => "Deprecated"],
|
|
],
|
|
"indexes" => [
|
|
"PRIMARY" => ["id"],
|
|
"uid_name" => ["uid", "name(190)"],
|
|
"self_uid" => ["self", "uid"],
|
|
"alias_uid" => ["alias(128)", "uid"],
|
|
"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)"],
|
|
"batch_contact-type" => ["batch(64)", "contact-type"],
|
|
"addr_uid" => ["addr(128)", "uid"],
|
|
"nurl_uid" => ["nurl(128)", "uid"],
|
|
"nick_uid" => ["nick(128)", "uid"],
|
|
"attag_uid" => ["attag(96)", "uid"],
|
|
"network_uid_lastupdate" => ["network", "uid", "last-update"],
|
|
"uid_network_self_lastupdate" => ["uid", "network", "self", "last-update"],
|
|
"next-update" => ["next-update"],
|
|
"local-data-next-update" => ["local-data", "next-update"],
|
|
"uid_lastitem" => ["uid", "last-item"],
|
|
"baseurl" => ["baseurl(64)"],
|
|
"uid_contact-type" => ["uid", "contact-type"],
|
|
"uid_self_contact-type" => ["uid", "self", "contact-type"],
|
|
"self_network_uid" => ["self", "network", "uid"],
|
|
"gsid_uid_failed" => ["gsid", "uid", "failed"],
|
|
"uri-id" => ["uri-id"],
|
|
]
|
|
],
|
|
"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(383)", "not null" => "1", "default" => "", "comment" => ""],
|
|
"type" => ["type" => "tinyint unsigned", "comment" => "Type of the tag (Unknown, General Collection, Follower Collection or Account)"],
|
|
],
|
|
"indexes" => [
|
|
"PRIMARY" => ["id"],
|
|
"type_name_url" => ["UNIQUE", "name", "url"],
|
|
"url" => ["url"]
|
|
]
|
|
],
|
|
"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"],
|
|
"allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
|
|
"allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed circles"],
|
|
"deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
|
|
"deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied circles"],
|
|
],
|
|
"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)"],
|
|
]
|
|
],
|
|
"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"],
|
|
"name" => ["name"]
|
|
]
|
|
],
|
|
// 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"],
|
|
"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"],
|
|
"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"],
|
|
"uid_description" => ["uid", "description(190)"],
|
|
]
|
|
],
|
|
"2fa_recovery_codes" => [
|
|
"comment" => "Two-factor authentication recovery codes",
|
|
"fields" => [
|
|
"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"]
|
|
]
|
|
],
|
|
"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"],
|
|
"trusted" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "Whenever this browser should be trusted or not"],
|
|
"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"],
|
|
]
|
|
],
|
|
"account-suggestion" => [
|
|
"comment" => "Account suggestion",
|
|
"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 account url"],
|
|
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User ID"],
|
|
"level" => ["type" => "smallint unsigned", "comment" => "level of closeness"],
|
|
"ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "If set, this account will not be suggested again"],
|
|
],
|
|
"indexes" => [
|
|
"PRIMARY" => ["uid", "uri-id"],
|
|
"uri-id_uid" => ["uri-id", "uid"],
|
|
]
|
|
],
|
|
"account-user" => [
|
|
"comment" => "Remote and local accounts",
|
|
"fields" => [
|
|
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
|
|
"uri-id" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the account url"],
|
|
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "foreign" => ["user" => "uid"], "comment" => "User ID"],
|
|
],
|
|
"indexes" => [
|
|
"PRIMARY" => ["id"],
|
|
"uri-id_uid" => ["UNIQUE", "uri-id", "uid"],
|
|
"uid_uri-id" => ["uid", "uri-id"],
|
|
]
|
|
],
|
|
"apcontact" => [
|
|
"comment" => "ActivityPub compatible contacts - used in the ActivityPub implementation",
|
|
"fields" => [
|
|
"url" => ["type" => "varbinary(383)", "not null" => "1", "primary" => "1", "comment" => "URL of the contact"],
|
|
"uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the apcontact url"],
|
|
"uuid" => ["type" => "varbinary(255)", "comment" => ""],
|
|
"type" => ["type" => "varchar(20)", "not null" => "1", "comment" => ""],
|
|
"following" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"followers" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"inbox" => ["type" => "varbinary(383)", "not null" => "1", "comment" => ""],
|
|
"outbox" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"sharedinbox" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"featured" => ["type" => "varbinary(383)", "comment" => "Address for the collection of featured posts"],
|
|
"featured-tags" => ["type" => "varbinary(383)", "comment" => "Address for the collection of featured tags"],
|
|
"manually-approve" => ["type" => "boolean", "comment" => ""],
|
|
"discoverable" => ["type" => "boolean", "comment" => "Mastodon extension: true if profile is published in their directory"],
|
|
"suspended" => ["type" => "boolean", "comment" => "Mastodon extension: true if profile is suspended"],
|
|
"nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
|
"name" => ["type" => "varchar(255)", "comment" => ""],
|
|
"about" => ["type" => "text", "comment" => ""],
|
|
"xmpp" => ["type" => "varchar(255)", "comment" => "XMPP address"],
|
|
"matrix" => ["type" => "varchar(255)", "comment" => "Matrix address"],
|
|
"photo" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"header" => ["type" => "varbinary(383)", "comment" => "Header picture"],
|
|
"addr" => ["type" => "varchar(255)", "comment" => ""],
|
|
"alias" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"pubkey" => ["type" => "text", "comment" => ""],
|
|
"subscribe" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"baseurl" => ["type" => "varbinary(383)", "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)"],
|
|
"baseurl" => ["baseurl(190)"],
|
|
"sharedinbox" => ["sharedinbox(190)"],
|
|
"gsid" => ["gsid"],
|
|
"uri-id" => ["UNIQUE", "uri-id"],
|
|
]
|
|
],
|
|
"application" => [
|
|
"comment" => "OAuth application",
|
|
"fields" => [
|
|
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "generated index"],
|
|
"client_id" => ["type" => "varchar(64)", "not null" => "1", "comment" => ""],
|
|
"client_secret" => ["type" => "varchar(64)", "not null" => "1", "comment" => ""],
|
|
"name" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
|
|
"redirect_uri" => ["type" => "varbinary(383)", "not null" => "1", "comment" => ""],
|
|
"website" => ["type" => "varbinary(383)", "comment" => ""],
|
|
"scopes" => ["type" => "varchar(255)", "comment" => ""],
|
|
"read" => ["type" => "boolean", "comment" => "Read scope"],
|
|
"write" => ["type" => "boolean", "comment" => "Write scope"],
|
|
"follow" => ["type" => "boolean", "comment" => "Follow scope"],
|
|
"push" => ["type" => "boolean", "comment" => "Push scope"],
|
|
],
|
|
"indexes" => [
|
|
"PRIMARY" => ["id"],
|
|
"client_id" => ["UNIQUE", "client_id"]
|
|
]
|
|
],
|
|
"application-marker" => [
|
|
"comment" => "Timeline marker",
|
|
"fields" => [
|
|
"application-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["application" => "id"], "comment" => ""],
|
|
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
|
|
"timeline" => ["type" => "varchar(64)", "not null" => "1", "primary" => "1", "comment" => "Marker (home, notifications)"],
|
|
"last_read_id" => ["type" => "varbinary(383)", "comment" => "Marker id for the timeline"],
|
|
"version" => ["type" => "smallint unsigned", "comment" => "Version number"],
|
|
"updated_at" => ["type" => "datetime", "comment" => "creation time"],
|
|
],
|
|
"indexes" => [
|
|
"PRIMARY" => ["application-id", "uid", "timeline"],
|
|
"uid_id" => ["uid"],
|
|
]
|
|
],
|
|
"application-token" => [
|
|
"comment" => "OAuth user token",
|
|
"fields" => [
|
|
"application-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["application" => "id"], "comment" => ""],
|
|
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
|
|
"code" => ["type" => "varchar(64)", "not null" => "1", "comment" => ""],
|
|
"access_token" => ["type" => "varchar(64)", "not null" => "1", "comment" => ""],
|
|
"created_at" => ["type" => "datetime", "not null" => "1", "comment" => "creation time"],
|
|
"scopes" => ["type" => "varchar(255)", "comment" => ""],
|
|
"read" => ["type" => "boolean", "comment" => "Read scope"],
|
|
"write" => ["type" => "boolean", "comment" => "Write scope"],
|
|
"follow" => ["type" => "boolean", "comment" => "Follow scope"],
|
|
"push" => ["type" => "boolean", "comment" => "Push scope"],
|
|
],
|
|
"indexes" => [
|
|
"PRIMARY" => ["application-id", "uid"],
|
|
"uid_id" => ["uid", "application-id"],
|
|
]
|
|
],
|
|
"attach" => [
|
|
"comment" => "file attachments",
|
|
"fields" => [
|
|
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "generated index"],
|
|
"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 circles"],
|
|
"deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
|
|
"deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied circles"],
|
|
"backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"],
|
|
"backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"],
|
|
],
|
|
"indexes" => [
|
|
"PRIMARY" => ["id"],
|
|
"uid" => ["uid"],
|
|
]
|
|
],
|
|
"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"],
|
|
]
|
|
],
|
|
"channel" => [
|
|
"comment" => "User defined Channels",
|
|
"fields" => [
|
|
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
|
|
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
|
|
"label" => ["type" => "varchar(64)", "not null" => "1", "comment" => "Channel label"],
|
|
"description" => ["type" => "varchar(64)", "comment" => "Channel description"],
|
|
"access-key" => ["type" => "varchar(1)", "comment" => "Access key"],
|
|
"include-tags" => ["type" => "varchar(255)", "comment" => "Comma separated list of tags that will be included in the channel"],
|
|
"exclude-tags" => ["type" => "varchar(255)", "comment" => "Comma separated list of tags that aren't allowed in the channel"],
|
|
"full-text-search" => ["type" => "varchar(255)", "comment" => "Full text search pattern, see https://mariadb.com/kb/en/full-text-index-overview/#in-boolean-mode"],
|
|
"media-type" => ["type" => "smallint unsigned", "comment" => "Filtered media types"],
|
|
|