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', 1366);
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 "manually-approve" => ["type" => "boolean", "comment" => ""],
157 "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
158 "archive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
159 "pending" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
160 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact has been deleted"],
161 "rating" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
162 "unsearchable" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact prefers to not be searchable"],
163 "sensitive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact posts sensitive content"],
164 "baseurl" => ["type" => "varchar(255)", "default" => "", "comment" => "baseurl of the contact"],
165 "gsid" => ["type" => "int unsigned", "foreign" => ["gserver" => "id", "on delete" => "restrict"], "comment" => "Global Server ID"],
166 "reason" => ["type" => "text", "comment" => ""],
167 "closeness" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "99", "comment" => ""],
168 "info" => ["type" => "mediumtext", "comment" => ""],
169 "profile-id" => ["type" => "int unsigned", "comment" => "Deprecated"],
170 "bdyear" => ["type" => "varchar(4)", "not null" => "1", "default" => "", "comment" => ""],
171 "bd" => ["type" => "date", "not null" => "1", "default" => DBA::NULL_DATE, "comment" => ""],
172 "notify_new_posts" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
173 "fetch_further_information" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
174 "ffi_keyword_denylist" => ["type" => "text", "comment" => ""],
178 "uid_name" => ["uid", "name(190)"],
179 "self_uid" => ["self", "uid"],
180 "alias_uid" => ["alias(96)", "uid"],
181 "pending_uid" => ["pending", "uid"],
182 "blocked_uid" => ["blocked", "uid"],
183 "uid_rel_network_poll" => ["uid", "rel", "network", "poll(64)", "archive"],
184 "uid_network_batch" => ["uid", "network", "batch(64)"],
185 "addr_uid" => ["addr(96)", "uid"],
186 "nurl_uid" => ["nurl(96)", "uid"],
187 "nick_uid" => ["nick(32)", "uid"],
188 "attag_uid" => ["attag(96)", "uid"],
189 "dfrn-id" => ["dfrn-id(64)"],
190 "issued-id" => ["issued-id(64)"],
191 "network_uid_lastupdate" => ["network", "uid", "last-update"],
192 "uid_network_self_lastupdate" => ["uid", "network", "self", "last-update"],
193 "uid_lastitem" => ["uid", "last-item"],
198 "comment" => "URI and GUID for items",
200 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
201 "uri" => ["type" => "varbinary(255)", "not null" => "1", "comment" => "URI of an item"],
202 "guid" => ["type" => "varbinary(255)", "comment" => "A unique identifier for an item"]
206 "uri" => ["UNIQUE", "uri"],
211 "comment" => "tags and mentions",
213 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
214 "name" => ["type" => "varchar(96)", "not null" => "1", "default" => "", "comment" => ""],
215 "url" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""]
219 "type_name_url" => ["UNIQUE", "name", "url"],
224 "comment" => "The local users",
226 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
227 "parent-uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"],
228 "comment" => "The parent user that has full control about this user"],
229 "guid" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this user"],
230 "username" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name that this user is known by"],
231 "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "encrypted password"],
232 "legacy_password" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is the password hash double-hashed?"],
233 "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "nick- and user name"],
234 "email" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "the users email address"],
235 "openid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
236 "timezone" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => "PHP-legal timezone"],
237 "language" => ["type" => "varchar(32)", "not null" => "1", "default" => "en", "comment" => "default language"],
238 "register_date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of registration"],
239 "login_date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of last login"],
240 "default-location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Default for item.location"],
241 "allow_location" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 allows to display the location"],
242 "theme" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "user theme preference"],
243 "pubkey" => ["type" => "text", "comment" => "RSA public key 4096 bit"],
244 "prvkey" => ["type" => "text", "comment" => "RSA private key 4096 bit"],
245 "spubkey" => ["type" => "text", "comment" => ""],
246 "sprvkey" => ["type" => "text", "comment" => ""],
247 "verified" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "user is verified through email"],
248 "blocked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 for user is blocked"],
249 "blockwall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to post to the profile page of the user"],
250 "hidewall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide profile details from unkown viewers"],
251 "blocktags" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to tag the post of this user"],
252 "unkmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Permit unknown people to send private mails to this user"],
253 "cntunkmail" => ["type" => "int unsigned", "not null" => "1", "default" => "10", "comment" => ""],
254 "notify-flags" => ["type" => "smallint unsigned", "not null" => "1", "default" => "65535", "comment" => "email notification options"],
255 "page-flags" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "page/profile type"],
256 "account-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
257 "prvnets" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
258 "pwdreset" => ["type" => "varchar(255)", "comment" => "Password reset request token"],
259 "pwdreset_time" => ["type" => "datetime", "comment" => "Timestamp of the last password reset request"],
260 "maxreq" => ["type" => "int unsigned", "not null" => "1", "default" => "10", "comment" => ""],
261 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
262 "account_removed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if 1 the account is removed"],
263 "account_expired" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
264 "account_expires_on" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp when account expires and will be deleted"],
265 "expire_notification_sent" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of last warning of account expiration"],
266 "def_gid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
267 "allow_cid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
268 "allow_gid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
269 "deny_cid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
270 "deny_gid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
271 "openidserver" => ["type" => "text", "comment" => ""],
274 "PRIMARY" => ["uid"],
275 "nickname" => ["nickname(32)"],
279 "comment" => "OAuth usage",
281 "client_id" => ["type" => "varchar(20)", "not null" => "1", "primary" => "1", "comment" => ""],
282 "pw" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => ""],
283 "redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
284 "name" => ["type" => "text", "comment" => ""],
285 "icon" => ["type" => "text", "comment" => ""],
286 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
289 "PRIMARY" => ["client_id"],
296 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
297 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner id of this permission set"],
298 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
299 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
300 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
301 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
305 "uid_allow_cid_allow_gid_deny_cid_deny_gid" => ["allow_cid(50)", "allow_gid(30)", "deny_cid(50)", "deny_gid(30)"],
309 "2fa_app_specific_password" => [
310 "comment" => "Two-factor app-specific _password",
312 "id" => ["type" => "mediumint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Password ID for revocation"],
313 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "foreign" => ["user" => "uid"], "comment" => "User ID"],
314 "description" => ["type" => "varchar(255)", "comment" => "Description of the usage of the password"],
315 "hashed_password" => ["type" => "varchar(255)", "not null" => "1", "comment" => "Hashed password"],
316 "generated" => ["type" => "datetime", "not null" => "1", "comment" => "Datetime the password was generated"],
317 "last_used" => ["type" => "datetime", "comment" => "Datetime the password was last used"],
321 "uid_description" => ["uid", "description(190)"],
324 "2fa_recovery_codes" => [
325 "comment" => "Two-factor authentication recovery codes",
327 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User ID"],
328 "code" => ["type" => "varchar(50)", "not null" => "1", "primary" => "1", "comment" => "Recovery code string"],
329 "generated" => ["type" => "datetime", "not null" => "1", "comment" => "Datetime the code was generated"],
330 "used" => ["type" => "datetime", "comment" => "Datetime the code was used"],
333 "PRIMARY" => ["uid", "code"]
337 "comment" => "registered addons",
339 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
340 "name" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "addon base (file)name"],
341 "version" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "currently unused"],
342 "installed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "currently always 1"],
343 "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "currently unused"],
344 "timestamp" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "file timestamp to check for reloads"],
345 "plugin_admin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 = has admin config, 0 = has no admin config"],
349 "name" => ["UNIQUE", "name"],
353 "comment" => "ActivityPub compatible contacts - used in the ActivityPub implementation",
355 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "URL of the contact"],
356 "uuid" => ["type" => "varchar(255)", "comment" => ""],
357 "type" => ["type" => "varchar(20)", "not null" => "1", "comment" => ""],
358 "following" => ["type" => "varchar(255)", "comment" => ""],
359 "followers" => ["type" => "varchar(255)", "comment" => ""],
360 "inbox" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
361 "outbox" => ["type" => "varchar(255)", "comment" => ""],
362 "sharedinbox" => ["type" => "varchar(255)", "comment" => ""],
363 "manually-approve" => ["type" => "boolean", "comment" => ""],
364 "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
365 "name" => ["type" => "varchar(255)", "comment" => ""],
366 "about" => ["type" => "text", "comment" => ""],
367 "photo" => ["type" => "varchar(255)", "comment" => ""],
368 "addr" => ["type" => "varchar(255)", "comment" => ""],
369 "alias" => ["type" => "varchar(255)", "comment" => ""],
370 "pubkey" => ["type" => "text", "comment" => ""],
371 "subscribe" => ["type" => "varchar(255)", "comment" => ""],
372 "baseurl" => ["type" => "varchar(255)", "comment" => "baseurl of the ap contact"],
373 "gsid" => ["type" => "int unsigned", "foreign" => ["gserver" => "id", "on delete" => "restrict"], "comment" => "Global Server ID"],
374 "generator" => ["type" => "varchar(255)", "comment" => "Name of the contact's system"],
375 "following_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of following contacts"],
376 "followers_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of followers"],
377 "statuses_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of posts"],
378 "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
381 "PRIMARY" => ["url"],
382 "addr" => ["addr(32)"],
383 "alias" => ["alias(190)"],
384 "followers" => ["followers(190)"],
385 "baseurl" => ["baseurl(190)"],
390 "comment" => "file attachments",
392 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "generated index"],
393 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
394 "hash" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "hash"],
395 "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "filename of original"],
396 "filetype" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "mimetype"],
397 "filesize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "size in bytes"],
398 "data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"],
399 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
400 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
401 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>"],
402 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
403 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
404 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
405 "backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"],
406 "backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"],
414 "comment" => "OAuth usage",
416 "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
417 "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "foreign" => ["clients" => "client_id"],
419 "redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
420 "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
421 "scope" => ["type" => "varchar(250)", "not null" => "1", "default" => "", "comment" => ""],
425 "client_id" => ["client_id"]
429 "comment" => "Stores temporary data",
431 "k" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "cache key"],
432 "v" => ["type" => "mediumtext", "comment" => "cached serialized value"],
433 "expires" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache expiration"],
434 "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache insertion"],
438 "k_expires" => ["k", "expires"],
444 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
445 "challenge" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
446 "dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
447 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
448 "type" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
449 "last_update" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
456 "comment" => "main configuration storage",
458 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
459 "cat" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
460 "k" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
461 "v" => ["type" => "mediumtext", "comment" => ""],
465 "cat_k" => ["UNIQUE", "cat", "k"],
468 "contact-relation" => [
469 "comment" => "Contact relations",
471 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "primary" => "1", "comment" => "contact the related contact had interacted with"],
472 "relation-cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "primary" => "1", "comment" => "related contact who had interacted with the contact"],
473 "last-interaction" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last interaction"],
474 "follow-updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last update of the contact relationship"],
475 "follows" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
478 "PRIMARY" => ["cid", "relation-cid"],
479 "relation-cid" => ["relation-cid"],
483 "comment" => "private messages",
485 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
486 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this conversation"],
487 "recips" => ["type" => "text", "comment" => "sender_handle;recipient_handle"],
488 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
489 "creator" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "handle of creator"],
490 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation timestamp"],
491 "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "edited timestamp"],
492 "subject" => ["type" => "text", "comment" => "subject of initial message"],
500 "comment" => "Raw data and structure information for messages",
502 "item-uri" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "Original URI of the item - unrelated to the table with the same name"],
503 "reply-to-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "URI to which this item is a reply"],
504 "conversation-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation URI"],
505 "conversation-href" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation link"],
506 "protocol" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "255", "comment" => "The protocol of the item"],
507 "direction" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "How the message arrived here: 1=push, 2=pull"],
508 "source" => ["type" => "mediumtext", "comment" => "Original source"],
509 "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Receiving date"],
512 "PRIMARY" => ["item-uri"],
513 "conversation-uri" => ["conversation-uri"],
514 "received" => ["received"],
517 "diaspora-interaction" => [
518 "comment" => "Signed Diaspora Interaction",
520 "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"],
521 "interaction" => ["type" => "mediumtext", "comment" => "The Diaspora interaction"]
524 "PRIMARY" => ["uri-id"]
528 "comment" => "Events",
530 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
531 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
532 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
533 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact_id (ID of the contact in contact table)"],
534 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
535 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
536 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
537 "start" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "event start time"],
538 "finish" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "event end time"],
539 "summary" => ["type" => "text", "comment" => "short description or title of the event"],
540 "desc" => ["type" => "text", "comment" => "event description"],
541 "location" => ["type" => "text", "comment" => "event location"],
542 "type" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => "event or birthday"],
543 "nofinish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if event does have no end this is 1"],
544 "adjust" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "adjust to timezone of the recipient (0 or 1)"],
545 "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "0 or 1"],
546 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
547 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
548 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
549 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
553 "uid_start" => ["uid", "start"],
558 "comment" => "Diaspora compatible contacts - used in the Diaspora implementation",
560 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
561 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "unique id"],
562 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
563 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
564 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
565 "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
566 "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
567 "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
568 "batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
569 "notify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
570 "poll" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
571 "confirm" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
572 "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
573 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
574 "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
575 "pubkey" => ["type" => "text", "comment" => ""],
576 "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
580 "addr" => ["addr(32)"],
581 "url" => ["UNIQUE", "url(190)"],
585 "comment" => "friend suggestion stuff",
587 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
588 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
589 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
590 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
591 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
592 "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
593 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
594 "note" => ["type" => "text", "comment" => ""],
595 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
604 "comment" => "privacy groups, group info",
606 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
607 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
608 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the member list is not private"],
609 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the group has been deleted"],
610 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "human readable name of group"],
618 "comment" => "privacy groups, member info",
620 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
621 "gid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["group" => "id"], "comment" => "groups.id of the associated group"],
622 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id of the member assigned to the associated group"],
626 "contactid" => ["contact-id"],
627 "gid_contactid" => ["UNIQUE", "gid", "contact-id"],
631 "comment" => "Tags that the server has subscribed",
633 "gserver-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["gserver" => "id"], "primary" => "1",
634 "comment" => "The id of the gserver"],
635 "tag" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "primary" => "1", "comment" => "Tag that the server has subscribed"],
638 "PRIMARY" => ["gserver-id", "tag"],
643 "comment" => "addon hook registry",
645 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
646 "hook" => ["type" => "varbinary(100)", "not null" => "1", "default" => "", "comment" => "name of hook"],
647 "file" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => "relative filename of hook handler"],
648 "function" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => "function name of hook handler"],
649 "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"],
653 "hook_file_function" => ["UNIQUE", "hook", "file", "function"],
657 "comment" => "Status of ActivityPub inboxes",
659 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "URL of the inbox"],
660 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date of this entry"],
661 "success" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last successful delivery"],
662 "failure" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last failed delivery"],
663 "previous" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Previous delivery date"],
664 "archive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is the inbox archived?"],
665 "shared" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is it a shared inbox?"]
674 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
675 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
676 "fid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["fcontact" => "id"], "comment" => ""],
677 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
678 "knowyou" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
679 "duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
680 "note" => ["type" => "text", "comment" => ""],
681 "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
682 "datetime" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
683 "blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
684 "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
688 "contact-id" => ["contact-id"],
693 "comment" => "Structure for all posts",
695 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
696 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this item"],
697 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
698 "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
699 "uri-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
700 "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"],
701 "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "uri of the parent to this item"],
702 "parent-uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table that contains the parent uri"],
703 "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"],
704 "thr-parent-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table that contains the thread parent uri"],
705 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation timestamp."],
706 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last edit (default is created)"],
707 "commented" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last comment/reply to this item"],
708 "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime"],
709 "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"],
710 "gravity" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
711 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network from where the item comes from"],
712 "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"],
713 "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"],
714 "icid" => ["type" => "int unsigned", "relation" => ["item-content" => "id"], "comment" => "Id of the item-content table entry that contains the whole item content"],
715 "iaid" => ["type" => "int unsigned", "relation" => ["item-activity" => "id"], "comment" => "Id of the item-activity table entry that contains the activity data"],
716 "vid" => ["type" => "smallint unsigned", "relation" => ["verb" => "id"], "comment" => "Id of the verb table entry that contains the activity verbs"],
717 "extid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
718 "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
719 "global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
720 "private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
721 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
722 "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
723 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been deleted"],
724 // User specific fields. Eventually they will move to user-item
725 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner id which owns this copy of the item"],
726 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact.id"],
727 "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "This item was posted to the wall of uid"],
728 "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item originated at this site"],
729 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
730 "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been favourited"],
731 "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "item has not been seen"],
732 "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "The owner of this item was mentioned in it"],
733 "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
734 "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this post"],
735 // It has to be decided whether these fields belong to the user or the structure
736 "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"],
737 "event-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["event" => "id"], "comment" => "Used to link to the event.id"],
738 // Could possibly be replaced by the "attach" table?
739 "attach" => ["type" => "mediumtext", "comment" => "JSON structure representing attachments to this item"],
740 // Deprecated fields. Will be removed in upcoming versions
741 "allow_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
742 "allow_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
743 "deny_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
744 "deny_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
745 "postopts" => ["type" => "text", "comment" => "Deprecated"],
746 "inform" => ["type" => "mediumtext", "comment" => "Deprecated"],
747 "type" => ["type" => "varchar(20)", "comment" => "Deprecated"],
748 "bookmark" => ["type" => "boolean", "comment" => "Deprecated"],
749 "file" => ["type" => "mediumtext", "comment" => "Deprecated"],
750 "location" => ["type" => "varchar(255)", "comment" => "Deprecated"],
751 "coord" => ["type" => "varchar(255)", "comment" => "Deprecated"],
752 "tag" => ["type" => "mediumtext", "comment" => "Deprecated"],
753 "plink" => ["type" => "varchar(255)", "comment" => "Deprecated"],
754 "title" => ["type" => "varchar(255)", "comment" => "Deprecated"],
755 "content-warning" => ["type" => "varchar(255)", "comment" => "Deprecated"],
756 "body" => ["type" => "mediumtext", "comment" => "Deprecated"],
757 "app" => ["type" => "varchar(255)", "comment" => "Deprecated"],
758 "verb" => ["type" => "varchar(100)", "comment" => "Deprecated"],
759 "object-type" => ["type" => "varchar(100)", "comment" => "Deprecated"],
760 "object" => ["type" => "text", "comment" => "Deprecated"],
761 "target-type" => ["type" => "varchar(100)", "comment" => "Deprecated"],
762 "target" => ["type" => "text", "comment" => "Deprecated"],
763 "author-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
764 "author-link" => ["type" => "varchar(255)", "comment" => "Deprecated"],
765 "author-avatar" => ["type" => "varchar(255)", "comment" => "Deprecated"],
766 "owner-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
767 "owner-link" => ["type" => "varchar(255)", "comment" => "Deprecated"],
768 "owner-avatar" => ["type" => "varchar(255)", "comment" => "Deprecated"],
769 "rendered-hash" => ["type" => "varchar(32)", "comment" => "Deprecated"],
770 "rendered-html" => ["type" => "mediumtext", "comment" => "Deprecated"],
774 "guid" => ["guid(191)"],
775 "uri" => ["uri(191)"],
776 "parent" => ["parent"],
777 "parent-uri" => ["parent-uri(191)"],
778 "extid" => ["extid(191)"],
779 "uid_id" => ["uid", "id"],
780 "uid_contactid_id" => ["uid", "contact-id", "id"],
781 "uid_received" => ["uid", "received"],
782 "uid_commented" => ["uid", "commented"],
783 "uid_unseen_contactid" => ["uid", "unseen", "contact-id"],
784 "uid_network_received" => ["uid", "network", "received"],
785 "uid_network_commented" => ["uid", "network", "commented"],
786 "uid_thrparent" => ["uid", "thr-parent(190)"],
787 "uid_parenturi" => ["uid", "parent-uri(190)"],
788 "uid_contactid_received" => ["uid", "contact-id", "received"],
789 "authorid_received" => ["author-id", "received"],
790 "ownerid" => ["owner-id"],
791 "contact-id" => ["contact-id"],
792 "uid_uri" => ["uid", "uri(190)"],
793 "resource-id" => ["resource-id"],
794 "deleted_changed" => ["deleted", "changed"],
795 "uid_wall_changed" => ["uid", "wall", "changed"],
796 "uid_unseen_wall" => ["uid", "unseen", "wall"],
797 "mention_uid_id" => ["mention", "uid", "id"],
798 "uid_eventid" => ["uid", "event-id"],
801 "psid_wall" => ["psid", "wall"],
802 "uri-id" => ["uri-id"],
803 "parent-uri-id" => ["parent-uri-id"],
804 "thr-parent-id" => ["thr-parent-id"],
808 "comment" => "Activities for items",
810 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
811 "uri" => ["type" => "varchar(255)", "comment" => ""],
812 "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
813 "uri-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
814 "activity" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""]
818 "uri-hash" => ["UNIQUE", "uri-hash"],
819 "uri" => ["uri(191)"],
820 "uri-id" => ["uri-id"]
824 "comment" => "Content for all posts",
826 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
827 "uri" => ["type" => "varchar(255)", "comment" => ""],
828 "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
829 "uri-plink-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
830 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "item title"],
831 "content-warning" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
832 "body" => ["type" => "mediumtext", "comment" => "item body content"],
833 "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "text location where this item originated"],
834 "coord" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "longitude/latitude pair representing location where this item originated"],
835 "language" => ["type" => "text", "comment" => "Language information about this post"],
836 "app" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "application which generated this item"],
837 "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
838 "rendered-html" => ["type" => "mediumtext", "comment" => "item.body converted to html"],
839 "object-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams object type"],
840 "object" => ["type" => "text", "comment" => "JSON encoded object structure unless it is an implied object (normal post)"],
841 "target-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams target type if applicable (URI)"],
842 "target" => ["type" => "text", "comment" => "JSON encoded target structure if used"],
843 "plink" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "permalink or URL to a displayable copy of the message at its source"],
844 "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams verb"]
848 "uri-plink-hash" => ["UNIQUE", "uri-plink-hash"],
849 "uri" => ["uri(191)"],
850 "plink" => ["plink(191)"],
851 "uri-id" => ["uri-id"]
857 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
858 "name" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => ""],
859 "locked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
860 "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process ID"],
861 "expires" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache expiration"],
865 "name_expires" => ["name", "expires"]
869 "comment" => "private messages",
871 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
872 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
873 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this private message"],
874 "from-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "name of the sender"],
875 "from-photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "contact photo link of the sender"],
876 "from-url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "profile linke of the sender"],
877 "contact-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => ["contact" => "id"], "comment" => "contact.id"],
878 "convid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["conv" => "id"], "comment" => "conv.id"],
879 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
880 "body" => ["type" => "mediumtext", "comment" => ""],
881 "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if message visited it is 1"],
882 "reply" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
883 "replied" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
884 "unknown" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if sender not in the contact table this is 1"],
885 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
886 "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
887 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time of the private message"],
891 "uid_seen" => ["uid", "seen"],
892 "convid" => ["convid"],
893 "uri" => ["uri(64)"],
894 "parent-uri" => ["parent-uri(64)"],
895 "contactid" => ["contact-id(32)"],
899 "comment" => "Mail account data for fetching mails",
901 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
902 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
903 "server" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
904 "port" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
905 "ssltype" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
906 "mailbox" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
907 "user" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
908 "pass" => ["type" => "text", "comment" => ""],
909 "reply_to" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
910 "action" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
911 "movetofolder" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
912 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
913 "last_check" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
921 "comment" => "table of accounts that can manage each other",
923 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
924 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
925 "mid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
929 "uid_mid" => ["UNIQUE", "uid", "mid"],
934 "comment" => "notifications",
936 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
937 "type" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
938 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
939 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
940 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
941 "date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
942 "msg" => ["type" => "mediumtext", "comment" => ""],
943 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
944 "link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
945 "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => "item.id"],
946 "parent" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
947 "uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the related post"],
948 "parent-uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
949 "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
950 "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""],
951 "otype" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => ""],
952 "name_cache" => ["type" => "tinytext", "comment" => "Cached bbcode parsing of name"],
953 "msg_cache" => ["type" => "mediumtext", "comment" => "Cached bbcode parsing of msg"]
957 "seen_uid_date" => ["seen", "uid", "date"],
958 "uid_date" => ["uid", "date"],
959 "uid_type_link" => ["uid", "type", "link(190)"],
962 "notify-threads" => [
965 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
966 "notify-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["notify" => "id"], "comment" => ""],
967 "master-parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
968 "master-parent-uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
969 "parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
970 "receiver-uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"],
971 "comment" => "User id"],
975 "master-parent-uri-id" => ["master-parent-uri-id"],
976 "receiver-uid" => ["receiver-uid"],
977 "notify-id" => ["notify-id"],
981 "comment" => "cache for OEmbed queries",
983 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
984 "maxwidth" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "comment" => "Maximum width passed to Oembed"],
985 "content" => ["type" => "mediumtext", "comment" => "OEmbed data of the page"],
986 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
989 "PRIMARY" => ["url", "maxwidth"],
990 "created" => ["created"],
993 "openwebauth-token" => [
994 "comment" => "Store OpenWebAuth token to verify contacts",
996 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
997 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id - currently unused"],
998 "type" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Verify type"],
999 "token" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A generated token"],
1000 "meta" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1001 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1004 "PRIMARY" => ["id"],
1009 "comment" => "cache for 'parse_url' queries",
1011 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
1012 "guessing" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the 'guessing' mode active?"],
1013 "oembed" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the data the result of oembed?"],
1014 "content" => ["type" => "mediumtext", "comment" => "page data"],
1015 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1018 "PRIMARY" => ["url", "guessing", "oembed"],
1019 "created" => ["created"],
1022 "participation" => [
1023 "comment" => "Storage for participation messages from Diaspora",
1025 "iid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item" => "id"], "comment" => ""],
1026 "server" => ["type" => "varchar(60)", "not null" => "1", "primary" => "1", "comment" => ""],
1027 "cid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["contact" => "id"], "comment" => ""],
1028 "fid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["fcontact" => "id"], "comment" => ""],
1031 "PRIMARY" => ["iid", "server"],
1037 "comment" => "personal (per user) configuration storage",
1039 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1040 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1041 "cat" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
1042 "k" => ["type" => "varbinary(100)", "not null" => "1", "default" => "", "comment" => ""],
1043 "v" => ["type" => "mediumtext", "comment" => ""],
1046 "PRIMARY" => ["id"],
1047 "uid_cat_k" => ["UNIQUE", "uid", "cat", "k"],
1051 "comment" => "photo storage",
1053 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1054 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
1055 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "contact.id"],
1056 "guid" => ["type" => "char(16)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this photo"],
1057 "resource-id" => ["type" => "char(32)", "not null" => "1", "default" => "", "comment" => ""],
1058 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation date"],
1059 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edited date"],
1060 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1061 "desc" => ["type" => "text", "comment" => ""],
1062 "album" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "The name of the album to which the photo belongs"],
1063 "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1064 "type" => ["type" => "varchar(30)", "not null" => "1", "default" => "image/jpeg"],
1065 "height" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1066 "width" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1067 "datasize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1068 "data" => ["type" => "mediumblob", "not null" => "1", "comment" => ""],
1069 "scale" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1070 "profile" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1071 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
1072 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
1073 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
1074 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
1075 "accessible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Make photo publicly accessible, ignoring permissions"],
1076 "backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"],
1077 "backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"],
1078 "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
1081 "PRIMARY" => ["id"],
1082 "contactid" => ["contact-id"],
1083 "uid_contactid" => ["uid", "contact-id"],
1084 "uid_profile" => ["uid", "profile"],
1085 "uid_album_scale_created" => ["uid", "album(32)", "scale", "created"],
1086 "uid_album_resource-id_created" => ["uid", "album(32)", "resource-id", "created"],
1087 "resource-id" => ["resource-id"],
1090 "post-category" => [
1091 "comment" => "post relation to categories",
1093 "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"],
1094 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
1095 "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1096 "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1099 "PRIMARY" => ["uri-id", "uid", "type", "tid"],
1103 "post-delivery-data" => [
1104 "comment" => "Delivery data for items",
1106 "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"],
1107 "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"],
1108 "inform" => ["type" => "mediumtext", "comment" => "Additional receivers of the linked item"],
1109 "queue_count" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Initial number of delivery recipients, used as item.delivery_queue_count"],
1110 "queue_done" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries, used as item.delivery_queue_done"],
1111 "queue_failed" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of unsuccessful deliveries, used as item.delivery_queue_failed"],
1112 "activitypub" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via ActivityPub"],
1113 "dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via DFRN"],
1114 "legacy_dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via legacy DFRN"],
1115 "diaspora" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via Diaspora"],
1116 "ostatus" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via OStatus"],
1119 "PRIMARY" => ["uri-id"],
1123 "comment" => "post relation to tags",
1125 "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"],
1126 "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1127 "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1128 "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"],
1131 "PRIMARY" => ["uri-id", "type", "tid", "cid"],
1137 "comment" => "Currently running system processes",
1139 "pid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "comment" => ""],
1140 "command" => ["type" => "varbinary(32)", "not null" => "1", "default" => "", "comment" => ""],
1141 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1144 "PRIMARY" => ["pid"],
1145 "command" => ["command"],
1149 "comment" => "user profiles data",
1151 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1152 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
1153 "profile-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1154 "is-default" => ["type" => "boolean", "comment" => "Deprecated"],
1155 "hide-friends" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide friend list from viewers of this profile"],
1156 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1157 "pdesc" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1158 "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00", "comment" => "Day of birth"],
1159 "address" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1160 "locality" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1161 "region" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1162 "postal-code" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1163 "country-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1164 "hometown" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1165 "gender" => ["type" => "varchar(32)", "comment" => "Deprecated"],
1166 "marital" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1167 "with" => ["type" => "text", "comment" => "Deprecated"],
1168 "howlong" => ["type" => "datetime", "comment" => "Deprecated"],
1169 "sexual" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1170 "politic" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1171 "religion" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1172 "pub_keywords" => ["type" => "text", "comment" => ""],
1173 "prv_keywords" => ["type" => "text", "comment" => ""],
1174 "likes" => ["type" => "text", "comment" => "Deprecated"],
1175 "dislikes" => ["type" => "text", "comment" => "Deprecated"],
1176 "about" => ["type" => "text", "comment" => "Profile description"],
1177 "summary" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1178 "music" => ["type" => "text", "comment" => "Deprecated"],
1179 "book" => ["type" => "text", "comment" => "Deprecated"],
1180 "tv" => ["type" => "text", "comment" => "Deprecated"],
1181 "film" => ["type" => "text", "comment" => "Deprecated"],
1182 "interest" => ["type" => "text", "comment" => "Deprecated"],
1183 "romance" => ["type" => "text", "comment" => "Deprecated"],
1184 "work" => ["type" => "text", "comment" => "Deprecated"],
1185 "education" => ["type" => "text", "comment" => "Deprecated"],
1186 "contact" => ["type" => "text", "comment" => "Deprecated"],
1187 "homepage" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1188 "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1189 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1190 "thumb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1191 "publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish default profile in local directory"],
1192 "net-publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish profile in global directory"],
1195 "PRIMARY" => ["id"],
1196 "uid_is-default" => ["uid", "is-default"],
1197 "pub_keywords" => ["FULLTEXT", "pub_keywords"],
1200 "profile_check" => [
1201 "comment" => "DFRN remote auth use",
1203 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1204 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1205 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id"],
1206 "dfrn_id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1207 "sec" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1208 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1211 "PRIMARY" => ["id"],
1216 "profile_field" => [
1217 "comment" => "Custom profile fields",
1219 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1220 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner user id"],
1221 "order" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "1", "comment" => "Field ordering per user"],
1222 "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this profile field - 0 = public"],
1223 "label" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Label of the field"],
1224 "value" => ["type" => "text", "comment" => "Value of the field"],
1225 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
1226 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
1229 "PRIMARY" => ["id"],
1231 "order" => ["order"],
1235 "push_subscriber" => [
1236 "comment" => "Used for OStatus: Contains feed subscribers",
1238 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1239 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1240 "callback_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1241 "topic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1242 "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1243 "push" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1244 "last_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last successful trial"],
1245 "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1246 "renewed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last subscription renewal"],
1247 "secret" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1250 "PRIMARY" => ["id"],
1251 "next_try" => ["next_try"],
1256 "comment" => "registrations requiring admin approval",
1258 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1259 "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1260 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1261 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1262 "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1263 "language" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
1264 "note" => ["type" => "text", "comment" => ""],
1267 "PRIMARY" => ["id"],
1274 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1275 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1276 "term" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1279 "PRIMARY" => ["id"],
1284 "comment" => "web session storage",
1286 "id" => ["type" => "bigint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1287 "sid" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
1288 "data" => ["type" => "text", "comment" => ""],
1289 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1292 "PRIMARY" => ["id"],
1293 "sid" => ["sid(64)"],
1294 "expire" => ["expire"],
1298 "comment" => "Data stored by Database storage backend",
1300 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented image data id"],
1301 "data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"]
1308 "comment" => "Thread related data",
1310 "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["item" => "id"],
1311 "comment" => "sequential ID"],
1312 "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
1313 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1314 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1315 "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Item owner"],
1316 "author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Item author"],
1317 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1318 "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1319 "commented" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1320 "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1321 "changed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1322 "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1323 "private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
1324 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1325 "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1326 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1327 "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1328 "ignored" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1329 "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
1330 "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
1331 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1332 "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1333 "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1334 "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1335 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
1336 "bookmark" => ["type" => "boolean", "comment" => ""],
1339 "PRIMARY" => ["iid"],
1340 "uid_network_commented" => ["uid", "network", "commented"],
1341 "uid_network_received" => ["uid", "network", "received"],
1342 "uid_contactid_commented" => ["uid", "contact-id", "commented"],
1343 "uid_contactid_received" => ["uid", "contact-id", "received"],
1344 "contactid" => ["contact-id"],
1345 "ownerid" => ["owner-id"],
1346 "authorid" => ["author-id"],
1347 "uid_received" => ["uid", "received"],
1348 "uid_commented" => ["uid", "commented"],
1349 "uid_wall_received" => ["uid", "wall", "received"],
1350 "private_wall_origin_commented" => ["private", "wall", "origin", "commented"],
1351 "uri-id" => ["uri-id"],
1355 "comment" => "OAuth usage",
1357 "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
1358 "secret" => ["type" => "text", "comment" => ""],
1359 "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "foreign" => ["clients" => "client_id"]],
1360 "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1361 "scope" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
1362 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1365 "PRIMARY" => ["id"],
1366 "client_id" => ["client_id"],
1371 "comment" => "Deleted usernames",
1373 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1374 "username" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
1377 "PRIMARY" => ["id"],
1378 "username" => ["username(32)"],
1382 "comment" => "User specific public contact data",
1384 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["contact" => "id"], "comment" => "Contact id of the linked public contact"],
1385 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1386 "blocked" => ["type" => "boolean", "comment" => "Contact is completely blocked for this user"],
1387 "ignored" => ["type" => "boolean", "comment" => "Posts from this contact are ignored"],
1388 "collapsed" => ["type" => "boolean", "comment" => "Posts from this contact are collapsed"]
1391 "PRIMARY" => ["uid", "cid"],
1396 "comment" => "User specific item data",
1398 "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["item" => "id"], "comment" => "Item id"],
1399 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1400 "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
1401 "ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"],
1402 "pinned" => ["type" => "boolean", "comment" => "The item is pinned on the profile page"],
1403 "notification-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1406 "PRIMARY" => ["uid", "iid"],
1407 "uid_pinned" => ["uid", "pinned"],
1408 "iid_uid" => ["iid", "uid"]
1412 "comment" => "Activity Verbs",
1414 "id" => ["type" => "smallint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
1415 "name" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""]
1422 "comment" => "Inter process communication between the frontend and the worker",
1424 "key" => ["type" => "int", "not null" => "1", "primary" => "1", "comment" => ""],
1425 "jobs" => ["type" => "boolean", "comment" => "Flag for outstanding jobs"],
1428 "PRIMARY" => ["key"],
1430 "engine" => "MEMORY",
1433 "comment" => "Background tasks queue entries",
1435 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented worker task id"],
1436 "parameter" => ["type" => "mediumtext", "comment" => "Task command"],
1437 "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Task priority"],
1438 "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date"],
1439 "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process id of the worker"],
1440 "executed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Execution date"],
1441 "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1442 "retrial" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1443 "done" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marked 1 when the task was done - will be deleted later"],
1446 "PRIMARY" => ["id"],
1447 "done_parameter" => ["done", "parameter(64)"],
1448 "done_executed" => ["done", "executed"],
1449 "done_priority_created" => ["done", "priority", "created"],
1450 "done_priority_next_try" => ["done", "priority", "next_try"],
1451 "done_pid_next_try" => ["done", "pid", "next_try"],
1452 "done_pid_retrial" => ["done", "pid", "retrial"],
1453 "done_pid_priority_created" => ["done", "pid", "priority", "created"]