+ // Side tables
+ "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" => ""],
+ "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" => ""],
+ "failed" => ["type" => "boolean", "comment" => "Connection failed"],
+ ],
+ "indexes" => [
+ "PRIMARY" => ["id"],
+ "nurl" => ["UNIQUE", "nurl(190)"],
+ ]
+ ],
+ "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", "relation" => ["user" => "uid"], "comment" => "User id"],
+ ],
+ "indexes" => [
+ "PRIMARY" => ["client_id"],
+ ]
+ ],
+ "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", "relation" => ["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"],
+ "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" => ""],
+ "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"],
+ "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"],
+ "last-discovery" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "date of the last follower discovery"],
+ "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" => ""],
+ "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"],
+ "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" => ""],
+ ],
+ "indexes" => [
+ "PRIMARY" => ["id"],
+ "uid_name" => ["uid", "name(190)"],
+ "self_uid" => ["self", "uid"],
+ "alias_uid" => ["alias(96)", "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)"],
+ "addr_uid" => ["addr(96)", "uid"],
+ "nurl_uid" => ["nurl(96)", "uid"],
+ "nick_uid" => ["nick(32)", "uid"],
+ "attag_uid" => ["attag(96)", "uid"],
+ "dfrn-id" => ["dfrn-id(64)"],
+ "issued-id" => ["issued-id(64)"],
+ "network_uid_lastupdate" => ["network", "uid", "last-update"],
+ "uid_network_self_lastupdate" => ["uid", "network", "self", "last-update"],
+ "uid_lastitem" => ["uid", "last-item"],
+ "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(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"]
+ ]
+ ],
+ "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", "relation" => ["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 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" => ["allow_cid(50)", "allow_gid(30)", "deny_cid(50)", "deny_gid(30)"],
+ ]
+ ],
+ "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"]
+ ]
+ ],
+ // Main tables