3 * @copyright Copyright (C) 2020, Friendica
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 * Main database structure configuration file.
22 * Here are described all the tables, fields and indexes Friendica needs to work.
24 * Syntax (braces indicate optionale values):
26 * "comment" => "Description of the table",
29 * "type" => "<field type>{(<field size>)} <unsigned>",
31 * {"extra" => "auto_increment",}
32 * {"default" => "<default value>",}
33 * {"default" => NULL_DATE,} (for datetime fields)
35 * {"foreign|relation" => ["<foreign key table name>" => "<foreign key field name>"],}
36 * "comment" => "Description of the fields"
41 * "PRIMARY" => ["<primary key field name>", ...],
42 * "<index name>" => [{"UNIQUE",} "<field name>{(<key size>)}", ...]
47 * Whenever possible prefer "foreign" before "relation" with the foreign keys.
48 * "foreign" adds true foreign keys on the database level, while "relation" simulates this behaviour.
50 * If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value below.
54 use Friendica\Database\DBA;
56 if (!defined('DB_UPDATE_VERSION')) {
57 define('DB_UPDATE_VERSION', 1364);
63 "comment" => "Global servers",
65 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
66 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
67 "nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
68 "version" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
69 "site_name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
70 "info" => ["type" => "text", "comment" => ""],
71 "register_policy" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
72 "registered-users" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Number of registered users"],
73 "directory-type" => ["type" => "tinyint", "default" => "0", "comment" => "Type of directory service (Poco, Mastodon)"],
74 "poco" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
75 "noscrape" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
76 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
77 "platform" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
78 "relay-subscribe" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Has the server subscribed to the relay system"],
79 "relay-scope" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => "The scope of messages that the server wants to get"],
80 "detection-method" => ["type" => "tinyint unsigned", "comment" => "Method that had been used to detect that server"],
81 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
82 "last_poco_query" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
83 "last_contact" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
84 "last_failure" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
85 "failed" => ["type" => "boolean", "comment" => "Connection failed"],
89 "nurl" => ["UNIQUE", "nurl(190)"],
93 "comment" => "contact table",
95 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
96 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
97 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
98 "updated" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => "Date of last contact update"],
99 "self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 if the contact is the user him/her self"],
100 "remote_self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
101 "rel" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "The kind of the relation between the user and the contact"],
102 "duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
103 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network of the contact"],
104 "protocol" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Protocol of the contact"],
105 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name that this contact is known by"],
106 "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Nick- and user name of the contact"],
107 "location" => ["type" => "varchar(255)", "default" => "", "comment" => ""],
108 "about" => ["type" => "text", "comment" => ""],
109 "keywords" => ["type" => "text", "comment" => "public keywords (interests) of the contact"],
110 "gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Deprecated"],
111 "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
112 "attag" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
113 "avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
114 "photo" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo of the contact"],
115 "thumb" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo (thumb size)"],
116 "micro" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo (micro size)"],
117 "site-pubkey" => ["type" => "text", "comment" => ""],
118 "issued-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
119 "dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
120 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
121 "nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
122 "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
123 "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
124 "pubkey" => ["type" => "text", "comment" => "RSA public key 4096 bit"],
125 "prvkey" => ["type" => "text", "comment" => "RSA private key 4096 bit"],
126 "batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
127 "request" => ["type" => "varchar(255)", "comment" => ""],
128 "notify" => ["type" => "varchar(255)", "comment" => ""],
129 "poll" => ["type" => "varchar(255)", "comment" => ""],
130 "confirm" => ["type" => "varchar(255)", "comment" => ""],
131 "subscribe" => ["type" => "varchar(255)", "comment" => ""],
132 "poco" => ["type" => "varchar(255)", "comment" => ""],
133 "aes_allow" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
134 "ret-aes" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
135 "usehub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
136 "subhub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
137 "hub-verify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
138 "last-update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last try to update the contact info"],
139 "success_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last successful contact update"],
140 "failure_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last failed update"],
141 "failed" => ["type" => "boolean", "comment" => "Connection failed"],
142 "name-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
143 "uri-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
144 "avatar-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
145 "term-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
146 "last-item" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "date of the last post"],
147 "last-discovery" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "date of the last follower discovery"],
148 "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
149 "blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "Node-wide block status"],
150 "block_reason" => ["type" => "text", "comment" => "Node-wide block reason"],
151 "readonly" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "posts of the contact are readonly"],
152 "writable" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
153 "forum" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "contact is a forum"],
154 "prv" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "contact is a private group"],
155 "contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
156 "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
157 "archive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
158 "pending" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
159 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact has been deleted"],
160 "rating" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
161 "unsearchable" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact prefers to not be searchable"],
162 "sensitive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact posts sensitive content"],
163 "baseurl" => ["type" => "varchar(255)", "default" => "", "comment" => "baseurl of the contact"],
164 "gsid" => ["type" => "int unsigned", "foreign" => ["gserver" => "id", "on delete" => "restrict"], "comment" => "Global Server ID"],
165 "reason" => ["type" => "text", "comment" => ""],
166 "closeness" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "99", "comment" => ""],
167 "info" => ["type" => "mediumtext", "comment" => ""],
168 "profile-id" => ["type" => "int unsigned", "comment" => "Deprecated"],
169 "bdyear" => ["type" => "varchar(4)", "not null" => "1", "default" => "", "comment" => ""],
170 "bd" => ["type" => "date", "not null" => "1", "default" => DBA::NULL_DATE, "comment" => ""],
171 "notify_new_posts" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
172 "fetch_further_information" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
173 "ffi_keyword_denylist" => ["type" => "text", "comment" => ""],
177 "uid_name" => ["uid", "name(190)"],
178 "self_uid" => ["self", "uid"],
179 "alias_uid" => ["alias(96)", "uid"],
180 "pending_uid" => ["pending", "uid"],
181 "blocked_uid" => ["blocked", "uid"],
182 "uid_rel_network_poll" => ["uid", "rel", "network", "poll(64)", "archive"],
183 "uid_network_batch" => ["uid", "network", "batch(64)"],
184 "addr_uid" => ["addr(96)", "uid"],
185 "nurl_uid" => ["nurl(96)", "uid"],
186 "nick_uid" => ["nick(32)", "uid"],
187 "attag_uid" => ["attag(96)", "uid"],
188 "dfrn-id" => ["dfrn-id(64)"],
189 "issued-id" => ["issued-id(64)"],
190 "network_uid_lastupdate" => ["network", "uid", "last-update"],
191 "uid_network_self_lastupdate" => ["uid", "network", "self", "last-update"],
192 "uid_lastitem" => ["uid", "last-item"],
197 "comment" => "URI and GUID for items",
199 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
200 "uri" => ["type" => "varbinary(255)", "not null" => "1", "comment" => "URI of an item"],
201 "guid" => ["type" => "varbinary(255)", "comment" => "A unique identifier for an item"]
205 "uri" => ["UNIQUE", "uri"],
210 "comment" => "tags and mentions",
212 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
213 "name" => ["type" => "varchar(96)", "not null" => "1", "default" => "", "comment" => ""],
214 "url" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""]
218 "type_name_url" => ["UNIQUE", "name", "url"],
223 "comment" => "The local users",
225 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
226 "parent-uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"],
227 "comment" => "The parent user that has full control about this user"],
228 "guid" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this user"],
229 "username" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name that this user is known by"],
230 "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "encrypted password"],
231 "legacy_password" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is the password hash double-hashed?"],
232 "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "nick- and user name"],
233 "email" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "the users email address"],
234 "openid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
235 "timezone" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => "PHP-legal timezone"],
236 "language" => ["type" => "varchar(32)", "not null" => "1", "default" => "en", "comment" => "default language"],
237 "register_date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of registration"],
238 "login_date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of last login"],
239 "default-location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Default for item.location"],
240 "allow_location" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 allows to display the location"],
241 "theme" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "user theme preference"],
242 "pubkey" => ["type" => "text", "comment" => "RSA public key 4096 bit"],
243 "prvkey" => ["type" => "text", "comment" => "RSA private key 4096 bit"],
244 "spubkey" => ["type" => "text", "comment" => ""],
245 "sprvkey" => ["type" => "text", "comment" => ""],
246 "verified" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "user is verified through email"],
247 "blocked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 for user is blocked"],
248 "blockwall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to post to the profile page of the user"],
249 "hidewall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide profile details from unkown viewers"],
250 "blocktags" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to tag the post of this user"],
251 "unkmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Permit unknown people to send private mails to this user"],
252 "cntunkmail" => ["type" => "int unsigned", "not null" => "1", "default" => "10", "comment" => ""],
253 "notify-flags" => ["type" => "smallint unsigned", "not null" => "1", "default" => "65535", "comment" => "email notification options"],
254 "page-flags" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "page/profile type"],
255 "account-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
256 "prvnets" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
257 "pwdreset" => ["type" => "varchar(255)", "comment" => "Password reset request token"],
258 "pwdreset_time" => ["type" => "datetime", "comment" => "Timestamp of the last password reset request"],
259 "maxreq" => ["type" => "int unsigned", "not null" => "1", "default" => "10", "comment" => ""],
260 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
261 "account_removed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if 1 the account is removed"],
262 "account_expired" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
263 "account_expires_on" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp when account expires and will be deleted"],
264 "expire_notification_sent" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of last warning of account expiration"],
265 "def_gid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
266 "allow_cid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
267 "allow_gid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
268 "deny_cid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
269 "deny_gid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
270 "openidserver" => ["type" => "text", "comment" => ""],
273 "PRIMARY" => ["uid"],
274 "nickname" => ["nickname(32)"],
278 "comment" => "OAuth usage",
280 "client_id" => ["type" => "varchar(20)", "not null" => "1", "primary" => "1", "comment" => ""],
281 "pw" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => ""],
282 "redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
283 "name" => ["type" => "text", "comment" => ""],
284 "icon" => ["type" => "text", "comment" => ""],
285 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
288 "PRIMARY" => ["client_id"],
295 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
296 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner id of this permission set"],
297 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
298 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
299 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
300 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
304 "uid_allow_cid_allow_gid_deny_cid_deny_gid" => ["allow_cid(50)", "allow_gid(30)", "deny_cid(50)", "deny_gid(30)"],
308 "2fa_app_specific_password" => [
309 "comment" => "Two-factor app-specific _password",
311 "id" => ["type" => "mediumint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Password ID for revocation"],
312 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "foreign" => ["user" => "uid"], "comment" => "User ID"],
313 "description" => ["type" => "varchar(255)", "comment" => "Description of the usage of the password"],
314 "hashed_password" => ["type" => "varchar(255)", "not null" => "1", "comment" => "Hashed password"],
315 "generated" => ["type" => "datetime", "not null" => "1", "comment" => "Datetime the password was generated"],
316 "last_used" => ["type" => "datetime", "comment" => "Datetime the password was last used"],
320 "uid_description" => ["uid", "description(190)"],
323 "2fa_recovery_codes" => [
324 "comment" => "Two-factor authentication recovery codes",
326 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User ID"],
327 "code" => ["type" => "varchar(50)", "not null" => "1", "primary" => "1", "comment" => "Recovery code string"],
328 "generated" => ["type" => "datetime", "not null" => "1", "comment" => "Datetime the code was generated"],
329 "used" => ["type" => "datetime", "comment" => "Datetime the code was used"],
332 "PRIMARY" => ["uid", "code"]
336 "comment" => "registered addons",
338 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
339 "name" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "addon base (file)name"],
340 "version" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "currently unused"],
341 "installed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "currently always 1"],
342 "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "currently unused"],
343 "timestamp" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "file timestamp to check for reloads"],
344 "plugin_admin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 = has admin config, 0 = has no admin config"],
348 "name" => ["UNIQUE", "name"],
352 "comment" => "ActivityPub compatible contacts - used in the ActivityPub implementation",
354 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "URL of the contact"],
355 "uuid" => ["type" => "varchar(255)", "comment" => ""],
356 "type" => ["type" => "varchar(20)", "not null" => "1", "comment" => ""],
357 "following" => ["type" => "varchar(255)", "comment" => ""],
358 "followers" => ["type" => "varchar(255)", "comment" => ""],
359 "inbox" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
360 "outbox" => ["type" => "varchar(255)", "comment" => ""],
361 "sharedinbox" => ["type" => "varchar(255)", "comment" => ""],
362 "manually-approve" => ["type" => "boolean", "comment" => ""],
363 "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
364 "name" => ["type" => "varchar(255)", "comment" => ""],
365 "about" => ["type" => "text", "comment" => ""],
366 "photo" => ["type" => "varchar(255)", "comment" => ""],
367 "addr" => ["type" => "varchar(255)", "comment" => ""],
368 "alias" => ["type" => "varchar(255)", "comment" => ""],
369 "pubkey" => ["type" => "text", "comment" => ""],
370 "subscribe" => ["type" => "varchar(255)", "comment" => ""],
371 "baseurl" => ["type" => "varchar(255)", "comment" => "baseurl of the ap contact"],
372 "gsid" => ["type" => "int unsigned", "foreign" => ["gserver" => "id", "on delete" => "restrict"], "comment" => "Global Server ID"],
373 "generator" => ["type" => "varchar(255)", "comment" => "Name of the contact's system"],
374 "following_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of following contacts"],
375 "followers_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of followers"],
376 "statuses_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of posts"],
377 "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
380 "PRIMARY" => ["url"],
381 "addr" => ["addr(32)"],
382 "alias" => ["alias(190)"],
383 "followers" => ["followers(190)"],
384 "baseurl" => ["baseurl(190)"],
389 "comment" => "file attachments",
391 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "generated index"],
392 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
393 "hash" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "hash"],
394 "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "filename of original"],
395 "filetype" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "mimetype"],
396 "filesize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "size in bytes"],
397 "data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"],
398 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
399 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
400 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>"],
401 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
402 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
403 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
404 "backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"],
405 "backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"],
413 "comment" => "OAuth usage",
415 "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
416 "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "foreign" => ["clients" => "client_id"],
418 "redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
419 "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
420 "scope" => ["type" => "varchar(250)", "not null" => "1", "default" => "", "comment" => ""],
424 "client_id" => ["client_id"]
428 "comment" => "Stores temporary data",
430 "k" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "cache key"],
431 "v" => ["type" => "mediumtext", "comment" => "cached serialized value"],
432 "expires" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache expiration"],
433 "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache insertion"],
437 "k_expires" => ["k", "expires"],
443 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
444 "challenge" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
445 "dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
446 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
447 "type" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
448 "last_update" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
455 "comment" => "main configuration storage",
457 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
458 "cat" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
459 "k" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
460 "v" => ["type" => "mediumtext", "comment" => ""],
464 "cat_k" => ["UNIQUE", "cat", "k"],
467 "contact-relation" => [
468 "comment" => "Contact relations",
470 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "primary" => "1", "comment" => "contact the related contact had interacted with"],
471 "relation-cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "primary" => "1", "comment" => "related contact who had interacted with the contact"],
472 "last-interaction" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last interaction"],
473 "follow-updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last update of the contact relationship"],
474 "follows" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
477 "PRIMARY" => ["cid", "relation-cid"],
478 "relation-cid" => ["relation-cid"],
482 "comment" => "private messages",
484 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
485 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this conversation"],
486 "recips" => ["type" => "text", "comment" => "sender_handle;recipient_handle"],
487 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
488 "creator" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "handle of creator"],
489 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation timestamp"],
490 "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "edited timestamp"],
491 "subject" => ["type" => "text", "comment" => "subject of initial message"],
499 "comment" => "Raw data and structure information for messages",
501 "item-uri" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "Original URI of the item - unrelated to the table with the same name"],
502 "reply-to-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "URI to which this item is a reply"],
503 "conversation-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation URI"],
504 "conversation-href" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation link"],
505 "protocol" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "255", "comment" => "The protocol of the item"],
506 "direction" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "How the message arrived here: 1=push, 2=pull"],
507 "source" => ["type" => "mediumtext", "comment" => "Original source"],
508 "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Receiving date"],
511 "PRIMARY" => ["item-uri"],
512 "conversation-uri" => ["conversation-uri"],
513 "received" => ["received"],
516 "diaspora-interaction" => [
517 "comment" => "Signed Diaspora Interaction",
519 "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"],
520 "interaction" => ["type" => "mediumtext", "comment" => "The Diaspora interaction"]
523 "PRIMARY" => ["uri-id"]
527 "comment" => "Events",
529 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
530 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
531 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
532 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact_id (ID of the contact in contact table)"],
533 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
534 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
535 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
536 "start" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "event start time"],
537 "finish" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "event end time"],
538 "summary" => ["type" => "text", "comment" => "short description or title of the event"],
539 "desc" => ["type" => "text", "comment" => "event description"],
540 "location" => ["type" => "text", "comment" => "event location"],
541 "type" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => "event or birthday"],
542 "nofinish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if event does have no end this is 1"],
543 "adjust" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "adjust to timezone of the recipient (0 or 1)"],
544 "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "0 or 1"],
545 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
546 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
547 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
548 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
552 "uid_start" => ["uid", "start"],
557 "comment" => "Diaspora compatible contacts - used in the Diaspora implementation",
559 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
560 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "unique id"],
561 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
562 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
563 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
564 "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
565 "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
566 "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
567 "batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
568 "notify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
569 "poll" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
570 "confirm" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
571 "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
572 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
573 "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
574 "pubkey" => ["type" => "text", "comment" => ""],
575 "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
579 "addr" => ["addr(32)"],
580 "url" => ["UNIQUE", "url(190)"],
584 "comment" => "friend suggestion stuff",
586 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
587 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
588 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
589 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
590 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
591 "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
592 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
593 "note" => ["type" => "text", "comment" => ""],
594 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
603 "comment" => "privacy groups, group info",
605 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
606 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
607 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the member list is not private"],
608 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the group has been deleted"],
609 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "human readable name of group"],
617 "comment" => "privacy groups, member info",
619 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
620 "gid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["group" => "id"], "comment" => "groups.id of the associated group"],
621 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id of the member assigned to the associated group"],
625 "contactid" => ["contact-id"],
626 "gid_contactid" => ["UNIQUE", "gid", "contact-id"],
630 "comment" => "Tags that the server has subscribed",
632 "gserver-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["gserver" => "id"], "primary" => "1",
633 "comment" => "The id of the gserver"],
634 "tag" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "primary" => "1", "comment" => "Tag that the server has subscribed"],
637 "PRIMARY" => ["gserver-id", "tag"],
642 "comment" => "addon hook registry",
644 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
645 "hook" => ["type" => "varbinary(100)", "not null" => "1", "default" => "", "comment" => "name of hook"],
646 "file" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => "relative filename of hook handler"],
647 "function" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => "function name of hook handler"],
648 "priority" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => "not yet implemented - can be used to sort conflicts in hook handling by calling handlers in priority order"],
652 "hook_file_function" => ["UNIQUE", "hook", "file", "function"],
656 "comment" => "Status of ActivityPub inboxes",
658 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "URL of the inbox"],
659 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date of this entry"],
660 "success" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last successful delivery"],
661 "failure" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last failed delivery"],
662 "previous" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Previous delivery date"],
663 "archive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is the inbox archived?"],
664 "shared" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is it a shared inbox?"]
673 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
674 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
675 "fid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["fcontact" => "id"], "comment" => ""],
676 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
677 "knowyou" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
678 "duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
679 "note" => ["type" => "text", "comment" => ""],
680 "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
681 "datetime" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
682 "blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
683 "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
687 "contact-id" => ["contact-id"],
692 "comment" => "Structure for all posts",
694 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => ["thread" => "iid"]],
695 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this item"],
696 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
697 "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
698 "uri-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
699 "parent" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => "item.id of the parent to this item if it is a reply of some form; otherwise this must be set to the id of this item"],
700 "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "uri of the parent to this item"],
701 "parent-uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table that contains the parent uri"],
702 "thr-parent" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "If the parent of this item is not the top-level item in the conversation, the uri of the immediate parent; otherwise set to parent-uri"],
703 "thr-parent-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table that contains the thread parent uri"],
704 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation timestamp."],
705 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last edit (default is created)"],
706 "commented" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last comment/reply to this item"],
707 "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime"],
708 "changed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date that something in the conversation changed, indicating clients should fetch the conversation again"],
709 "gravity" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
710 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network from where the item comes from"],
711 "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Link to the contact table with uid=0 of the owner of this item"],
712 "author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Link to the contact table with uid=0 of the author of this item"],
713 "icid" => ["type" => "int unsigned", "relation" => ["item-content" => "id"], "comment" => "Id of the item-content table entry that contains the whole item content"],
714 "iaid" => ["type" => "int unsigned", "relation" => ["item-activity" => "id"], "comment" => "Id of the item-activity table entry that contains the activity data"],
715 "vid" => ["type" => "smallint unsigned", "relation" => ["verb" => "id"], "comment" => "Id of the verb table entry that contains the activity verbs"],
716 "extid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
717 "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
718 "global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
719 "private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
720 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
721 "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
722 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been deleted"],
723 // User specific fields. Eventually they will move to user-item
724 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner id which owns this copy of the item"],
725 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact.id"],
726 "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "This item was posted to the wall of uid"],
727 "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item originated at this site"],
728 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
729 "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been favourited"],
730 "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "item has not been seen"],
731 "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "The owner of this item was mentioned in it"],
732 "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
733 "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this post"],
734 // It has to be decided whether these fields belong to the user or the structure
735 "resource-id" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type"],
736 "event-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["event" => "id"], "comment" => "Used to link to the event.id"],
737 // Could possibly be replaced by the "attach" table?
738 "attach" => ["type" => "mediumtext", "comment" => "JSON structure representing attachments to this item"],
739 // Deprecated fields. Will be removed in upcoming versions
740 "allow_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
741 "allow_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
742 "deny_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
743 "deny_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
744 "postopts" => ["type" => "text", "comment" => "Deprecated"],
745 "inform" => ["type" => "mediumtext", "comment" => "Deprecated"],
746 "type" => ["type" => "varchar(20)", "comment" => "Deprecated"],
747 "bookmark" => ["type" => "boolean", "comment" => "Deprecated"],
748 "file" => ["type" => "mediumtext", "comment" => "Deprecated"],
749 "location" => ["type" => "varchar(255)", "comment" => "Deprecated"],
750 "coord" => ["type" => "varchar(255)", "comment" => "Deprecated"],
751 "tag" => ["type" => "mediumtext", "comment" => "Deprecated"],
752 "plink" => ["type" => "varchar(255)", "comment" => "Deprecated"],
753 "title" => ["type" => "varchar(255)", "comment" => "Deprecated"],
754 "content-warning" => ["type" => "varchar(255)", "comment" => "Deprecated"],
755 "body" => ["type" => "mediumtext", "comment" => "Deprecated"],
756 "app" => ["type" => "varchar(255)", "comment" => "Deprecated"],
757 "verb" => ["type" => "varchar(100)", "comment" => "Deprecated"],
758 "object-type" => ["type" => "varchar(100)", "comment" => "Deprecated"],
759 "object" => ["type" => "text", "comment" => "Deprecated"],
760 "target-type" => ["type" => "varchar(100)", "comment" => "Deprecated"],
761 "target" => ["type" => "text", "comment" => "Deprecated"],
762 "author-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
763 "author-link" => ["type" => "varchar(255)", "comment" => "Deprecated"],
764 "author-avatar" => ["type" => "varchar(255)", "comment" => "Deprecated"],
765 "owner-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
766 "owner-link" => ["type" => "varchar(255)", "comment" => "Deprecated"],
767 "owner-avatar" => ["type" => "varchar(255)", "comment" => "Deprecated"],
768 "rendered-hash" => ["type" => "varchar(32)", "comment" => "Deprecated"],
769 "rendered-html" => ["type" => "mediumtext", "comment" => "Deprecated"],
773 "guid" => ["guid(191)"],
774 "uri" => ["uri(191)"],
775 "parent" => ["parent"],
776 "parent-uri" => ["parent-uri(191)"],
777 "extid" => ["extid(191)"],
778 "uid_id" => ["uid", "id"],
779 "uid_contactid_id" => ["uid", "contact-id", "id"],
780 "uid_received" => ["uid", "received"],
781 "uid_commented" => ["uid", "commented"],
782 "uid_unseen_contactid" => ["uid", "unseen", "contact-id"],
783 "uid_network_received" => ["uid", "network", "received"],
784 "uid_network_commented" => ["uid", "network", "commented"],
785 "uid_thrparent" => ["uid", "thr-parent(190)"],
786 "uid_parenturi" => ["uid", "parent-uri(190)"],
787 "uid_contactid_received" => ["uid", "contact-id", "received"],
788 "authorid_received" => ["author-id", "received"],
789 "ownerid" => ["owner-id"],
790 "contact-id" => ["contact-id"],
791 "uid_uri" => ["uid", "uri(190)"],
792 "resource-id" => ["resource-id"],
793 "deleted_changed" => ["deleted", "changed"],
794 "uid_wall_changed" => ["uid", "wall", "changed"],
795 "uid_unseen_wall" => ["uid", "unseen", "wall"],
796 "mention_uid_id" => ["mention", "uid", "id"],
797 "uid_eventid" => ["uid", "event-id"],
800 "psid_wall" => ["psid", "wall"],
801 "uri-id" => ["uri-id"],
802 "parent-uri-id" => ["parent-uri-id"],
803 "thr-parent-id" => ["thr-parent-id"],
807 "comment" => "Activities for items",
809 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
810 "uri" => ["type" => "varchar(255)", "comment" => ""],
811 "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
812 "uri-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
813 "activity" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""]
817 "uri-hash" => ["UNIQUE", "uri-hash"],
818 "uri" => ["uri(191)"],
819 "uri-id" => ["uri-id"]
823 "comment" => "Content for all posts",
825 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
826 "uri" => ["type" => "varchar(255)", "comment" => ""],
827 "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
828 "uri-plink-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
829 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "item title"],
830 "content-warning" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
831 "body" => ["type" => "mediumtext", "comment" => "item body content"],
832 "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "text location where this item originated"],
833 "coord" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "longitude/latitude pair representing location where this item originated"],
834 "language" => ["type" => "text", "comment" => "Language information about this post"],
835 "app" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "application which generated this item"],
836 "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
837 "rendered-html" => ["type" => "mediumtext", "comment" => "item.body converted to html"],
838 "object-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams object type"],
839 "object" => ["type" => "text", "comment" => "JSON encoded object structure unless it is an implied object (normal post)"],
840 "target-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams target type if applicable (URI)"],
841 "target" => ["type" => "text", "comment" => "JSON encoded target structure if used"],
842 "plink" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "permalink or URL to a displayable copy of the message at its source"],
843 "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams verb"]
847 "uri-plink-hash" => ["UNIQUE", "uri-plink-hash"],
848 "uri" => ["uri(191)"],
849 "plink" => ["plink(191)"],
850 "uri-id" => ["uri-id"]
856 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
857 "name" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => ""],
858 "locked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
859 "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process ID"],
860 "expires" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache expiration"],
864 "name_expires" => ["name", "expires"]
868 "comment" => "private messages",
870 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
871 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
872 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this private message"],
873 "from-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "name of the sender"],
874 "from-photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "contact photo link of the sender"],
875 "from-url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "profile linke of the sender"],
876 "contact-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => ["contact" => "id"], "comment" => "contact.id"],
877 "convid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["conv" => "id"], "comment" => "conv.id"],
878 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
879 "body" => ["type" => "mediumtext", "comment" => ""],
880 "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if message visited it is 1"],
881 "reply" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
882 "replied" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
883 "unknown" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if sender not in the contact table this is 1"],
884 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
885 "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
886 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time of the private message"],
890 "uid_seen" => ["uid", "seen"],
891 "convid" => ["convid"],
892 "uri" => ["uri(64)"],
893 "parent-uri" => ["parent-uri(64)"],
894 "contactid" => ["contact-id(32)"],
898 "comment" => "Mail account data for fetching mails",
900 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
901 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
902 "server" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
903 "port" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
904 "ssltype" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
905 "mailbox" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
906 "user" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
907 "pass" => ["type" => "text", "comment" => ""],
908 "reply_to" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
909 "action" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
910 "movetofolder" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
911 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
912 "last_check" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
920 "comment" => "table of accounts that can manage each other",
922 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
923 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
924 "mid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
928 "uid_mid" => ["UNIQUE", "uid", "mid"],
933 "comment" => "notifications",
935 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
936 "type" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
937 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
938 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
939 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
940 "date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
941 "msg" => ["type" => "mediumtext", "comment" => ""],
942 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
943 "link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
944 "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => "item.id"],
945 "parent" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
946 "uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the related post"],
947 "parent-uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
948 "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
949 "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""],
950 "otype" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => ""],
951 "name_cache" => ["type" => "tinytext", "comment" => "Cached bbcode parsing of name"],
952 "msg_cache" => ["type" => "mediumtext", "comment" => "Cached bbcode parsing of msg"]
956 "seen_uid_date" => ["seen", "uid", "date"],
957 "uid_date" => ["uid", "date"],
958 "uid_type_link" => ["uid", "type", "link(190)"],
961 "notify-threads" => [
964 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
965 "notify-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["notify" => "id"], "comment" => ""],
966 "master-parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
967 "master-parent-uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
968 "parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
969 "receiver-uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"],
970 "comment" => "User id"],
974 "master-parent-uri-id" => ["master-parent-uri-id"],
975 "receiver-uid" => ["receiver-uid"],
979 "comment" => "cache for OEmbed queries",
981 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
982 "maxwidth" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "comment" => "Maximum width passed to Oembed"],
983 "content" => ["type" => "mediumtext", "comment" => "OEmbed data of the page"],
984 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
987 "PRIMARY" => ["url", "maxwidth"],
988 "created" => ["created"],
991 "openwebauth-token" => [
992 "comment" => "Store OpenWebAuth token to verify contacts",
994 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
995 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
996 "type" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Verify type"],
997 "token" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A generated token"],
998 "meta" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
999 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1002 "PRIMARY" => ["id"],
1007 "comment" => "cache for 'parse_url' queries",
1009 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
1010 "guessing" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the 'guessing' mode active?"],
1011 "oembed" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the data the result of oembed?"],
1012 "content" => ["type" => "mediumtext", "comment" => "page data"],
1013 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1016 "PRIMARY" => ["url", "guessing", "oembed"],
1017 "created" => ["created"],
1020 "participation" => [
1021 "comment" => "Storage for participation messages from Diaspora",
1023 "iid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item" => "id"], "comment" => ""],
1024 "server" => ["type" => "varchar(60)", "not null" => "1", "primary" => "1", "comment" => ""],
1025 "cid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["contact" => "id"], "comment" => ""],
1026 "fid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["fcontact" => "id"], "comment" => ""],
1029 "PRIMARY" => ["iid", "server"],
1035 "comment" => "personal (per user) configuration storage",
1037 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1038 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1039 "cat" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
1040 "k" => ["type" => "varbinary(100)", "not null" => "1", "default" => "", "comment" => ""],
1041 "v" => ["type" => "mediumtext", "comment" => ""],
1044 "PRIMARY" => ["id"],
1045 "uid_cat_k" => ["UNIQUE", "uid", "cat", "k"],
1049 "comment" => "photo storage",
1051 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1052 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
1053 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "contact.id"],
1054 "guid" => ["type" => "char(16)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this photo"],
1055 "resource-id" => ["type" => "char(32)", "not null" => "1", "default" => "", "comment" => ""],
1056 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation date"],
1057 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edited date"],
1058 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1059 "desc" => ["type" => "text", "comment" => ""],
1060 "album" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "The name of the album to which the photo belongs"],
1061 "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1062 "type" => ["type" => "varchar(30)", "not null" => "1", "default" => "image/jpeg"],
1063 "height" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1064 "width" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1065 "datasize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1066 "data" => ["type" => "mediumblob", "not null" => "1", "comment" => ""],
1067 "scale" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1068 "profile" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1069 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
1070 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
1071 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
1072 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
1073 "accessible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Make photo publicly accessible, ignoring permissions"],
1074 "backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"],
1075 "backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"],
1076 "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
1079 "PRIMARY" => ["id"],
1080 "contactid" => ["contact-id"],
1081 "uid_contactid" => ["uid", "contact-id"],
1082 "uid_profile" => ["uid", "profile"],
1083 "uid_album_scale_created" => ["uid", "album(32)", "scale", "created"],
1084 "uid_album_resource-id_created" => ["uid", "album(32)", "resource-id", "created"],
1085 "resource-id" => ["resource-id"],
1088 "post-category" => [
1089 "comment" => "post relation to categories",
1091 "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"],
1092 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
1093 "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1094 "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1097 "PRIMARY" => ["uri-id", "uid", "type", "tid"],
1101 "post-delivery-data" => [
1102 "comment" => "Delivery data for items",
1104 "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"],
1105 "postopts" => ["type" => "text", "comment" => "External post connectors add their network name to this comma-separated string to identify that they should be delivered to these networks during delivery"],
1106 "inform" => ["type" => "mediumtext", "comment" => "Additional receivers of the linked item"],
1107 "queue_count" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Initial number of delivery recipients, used as item.delivery_queue_count"],
1108 "queue_done" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries, used as item.delivery_queue_done"],
1109 "queue_failed" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of unsuccessful deliveries, used as item.delivery_queue_failed"],
1110 "activitypub" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via ActivityPub"],
1111 "dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via DFRN"],
1112 "legacy_dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via legacy DFRN"],
1113 "diaspora" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via Diaspora"],
1114 "ostatus" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via OStatus"],
1117 "PRIMARY" => ["uri-id"],
1121 "comment" => "post relation to tags",
1123 "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"],
1124 "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1125 "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1126 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Contact id of the mentioned public contact"],
1129 "PRIMARY" => ["uri-id", "type", "tid", "cid"],
1135 "comment" => "Currently running system processes",
1137 "pid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "comment" => ""],
1138 "command" => ["type" => "varbinary(32)", "not null" => "1", "default" => "", "comment" => ""],
1139 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1142 "PRIMARY" => ["pid"],
1143 "command" => ["command"],
1147 "comment" => "user profiles data",
1149 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1150 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
1151 "profile-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1152 "is-default" => ["type" => "boolean", "comment" => "Deprecated"],
1153 "hide-friends" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide friend list from viewers of this profile"],
1154 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1155 "pdesc" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1156 "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00", "comment" => "Day of birth"],
1157 "address" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1158 "locality" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1159 "region" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1160 "postal-code" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1161 "country-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1162 "hometown" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1163 "gender" => ["type" => "varchar(32)", "comment" => "Deprecated"],
1164 "marital" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1165 "with" => ["type" => "text", "comment" => "Deprecated"],
1166 "howlong" => ["type" => "datetime", "comment" => "Deprecated"],
1167 "sexual" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1168 "politic" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1169 "religion" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1170 "pub_keywords" => ["type" => "text", "comment" => ""],
1171 "prv_keywords" => ["type" => "text", "comment" => ""],
1172 "likes" => ["type" => "text", "comment" => "Deprecated"],
1173 "dislikes" => ["type" => "text", "comment" => "Deprecated"],
1174 "about" => ["type" => "text", "comment" => "Profile description"],
1175 "summary" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1176 "music" => ["type" => "text", "comment" => "Deprecated"],
1177 "book" => ["type" => "text", "comment" => "Deprecated"],
1178 "tv" => ["type" => "text", "comment" => "Deprecated"],
1179 "film" => ["type" => "text", "comment" => "Deprecated"],
1180 "interest" => ["type" => "text", "comment" => "Deprecated"],
1181 "romance" => ["type" => "text", "comment" => "Deprecated"],
1182 "work" => ["type" => "text", "comment" => "Deprecated"],
1183 "education" => ["type" => "text", "comment" => "Deprecated"],
1184 "contact" => ["type" => "text", "comment" => "Deprecated"],
1185 "homepage" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1186 "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1187 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1188 "thumb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1189 "publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish default profile in local directory"],
1190 "net-publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish profile in global directory"],
1193 "PRIMARY" => ["id"],
1194 "uid_is-default" => ["uid", "is-default"],
1195 "pub_keywords" => ["FULLTEXT", "pub_keywords"],
1198 "profile_check" => [
1199 "comment" => "DFRN remote auth use",
1201 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1202 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1203 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id"],
1204 "dfrn_id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1205 "sec" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1206 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1209 "PRIMARY" => ["id"],
1214 "profile_field" => [
1215 "comment" => "Custom profile fields",
1217 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1218 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner user id"],
1219 "order" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "1", "comment" => "Field ordering per user"],
1220 "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this profile field - 0 = public"],
1221 "label" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Label of the field"],
1222 "value" => ["type" => "text", "comment" => "Value of the field"],
1223 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
1224 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
1227 "PRIMARY" => ["id"],
1229 "order" => ["order"],
1233 "push_subscriber" => [
1234 "comment" => "Used for OStatus: Contains feed subscribers",
1236 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1237 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1238 "callback_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1239 "topic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1240 "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1241 "push" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1242 "last_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last successful trial"],
1243 "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1244 "renewed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last subscription renewal"],
1245 "secret" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1248 "PRIMARY" => ["id"],
1249 "next_try" => ["next_try"],
1254 "comment" => "registrations requiring admin approval",
1256 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1257 "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1258 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1259 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1260 "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1261 "language" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
1262 "note" => ["type" => "text", "comment" => ""],
1265 "PRIMARY" => ["id"],
1272 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1273 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1274 "term" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1277 "PRIMARY" => ["id"],
1282 "comment" => "web session storage",
1284 "id" => ["type" => "bigint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1285 "sid" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
1286 "data" => ["type" => "text", "comment" => ""],
1287 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1290 "PRIMARY" => ["id"],
1291 "sid" => ["sid(64)"],
1292 "expire" => ["expire"],
1296 "comment" => "Data stored by Database storage backend",
1298 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented image data id"],
1299 "data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"]
1306 "comment" => "Thread related data",
1308 "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"],
1309 "comment" => "sequential ID"],
1310 "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
1311 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1312 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1313 "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Item owner"],
1314 "author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Item author"],
1315 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1316 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1317 "commented" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1318 "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1319 "changed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1320 "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1321 "private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
1322 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1323 "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1324 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1325 "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1326 "ignored" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1327 "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
1328 "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
1329 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1330 "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1331 "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1332 "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1333 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
1334 "bookmark" => ["type" => "boolean", "comment" => ""],
1337 "PRIMARY" => ["iid"],
1338 "uid_network_commented" => ["uid", "network", "commented"],
1339 "uid_network_received" => ["uid", "network", "received"],
1340 "uid_contactid_commented" => ["uid", "contact-id", "commented"],
1341 "uid_contactid_received" => ["uid", "contact-id", "received"],
1342 "contactid" => ["contact-id"],
1343 "ownerid" => ["owner-id"],
1344 "authorid" => ["author-id"],
1345 "uid_received" => ["uid", "received"],
1346 "uid_commented" => ["uid", "commented"],
1347 "uid_wall_received" => ["uid", "wall", "received"],
1348 "private_wall_origin_commented" => ["private", "wall", "origin", "commented"],
1349 "uri-id" => ["uri-id"],
1353 "comment" => "OAuth usage",
1355 "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
1356 "secret" => ["type" => "text", "comment" => ""],
1357 "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "foreign" => ["clients" => "client_id"]],
1358 "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1359 "scope" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
1360 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1363 "PRIMARY" => ["id"],
1364 "client_id" => ["client_id"],
1369 "comment" => "Deleted usernames",
1371 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1372 "username" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
1375 "PRIMARY" => ["id"],
1376 "username" => ["username(32)"],
1380 "comment" => "User specific public contact data",
1382 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["contact" => "id"], "comment" => "Contact id of the linked public contact"],
1383 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1384 "blocked" => ["type" => "boolean", "comment" => "Contact is completely blocked for this user"],
1385 "ignored" => ["type" => "boolean", "comment" => "Posts from this contact are ignored"],
1386 "collapsed" => ["type" => "boolean", "comment" => "Posts from this contact are collapsed"]
1389 "PRIMARY" => ["uid", "cid"],
1394 "comment" => "User specific item data",
1396 "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["item" => "id"], "comment" => "Item id"],
1397 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1398 "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
1399 "ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"],
1400 "pinned" => ["type" => "boolean", "comment" => "The item is pinned on the profile page"],
1401 "notification-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1404 "PRIMARY" => ["uid", "iid"],
1405 "uid_pinned" => ["uid", "pinned"],
1406 "iid_uid" => ["iid", "uid"]
1410 "comment" => "Activity Verbs",
1412 "id" => ["type" => "smallint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
1413 "name" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""]
1420 "comment" => "Inter process communication between the frontend and the worker",
1422 "key" => ["type" => "int", "not null" => "1", "primary" => "1", "comment" => ""],
1423 "jobs" => ["type" => "boolean", "comment" => "Flag for outstanding jobs"],
1426 "PRIMARY" => ["key"],
1428 "engine" => "MEMORY",
1431 "comment" => "Background tasks queue entries",
1433 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented worker task id"],
1434 "parameter" => ["type" => "mediumtext", "comment" => "Task command"],
1435 "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Task priority"],
1436 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date"],
1437 "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process id of the worker"],
1438 "executed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Execution date"],
1439 "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1440 "retrial" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1441 "done" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marked 1 when the task was done - will be deleted later"],
1444 "PRIMARY" => ["id"],
1445 "done_parameter" => ["done", "parameter(64)"],
1446 "done_executed" => ["done", "executed"],
1447 "done_priority_created" => ["done", "priority", "created"],
1448 "done_priority_next_try" => ["done", "priority", "next_try"],
1449 "done_pid_next_try" => ["done", "pid", "next_try"],
1450 "done_pid_retrial" => ["done", "pid", "retrial"],
1451 "done_pid_priority_created" => ["done", "pid", "priority", "created"]