]> git.mxchange.org Git - friendica.git/commitdiff
Indexes and foreign keys added
authorMichael <heluecht@pirati.ca>
Mon, 14 Jun 2021 08:53:37 +0000 (08:53 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 14 Jun 2021 08:53:37 +0000 (08:53 +0000)
73 files changed:
doc/database/db_2fa_app_specific_password.md
doc/database/db_2fa_recovery_codes.md
doc/database/db_2fa_trusted_browser.md
doc/database/db_addon.md
doc/database/db_apcontact.md
doc/database/db_application-token.md
doc/database/db_application.md
doc/database/db_attach.md
doc/database/db_auth_codes.md
doc/database/db_cache.md
doc/database/db_challenge.md
doc/database/db_clients.md
doc/database/db_config.md
doc/database/db_contact-relation.md
doc/database/db_contact.md
doc/database/db_conv.md
doc/database/db_conversation.md
doc/database/db_delayed-post.md
doc/database/db_diaspora-interaction.md
doc/database/db_event.md
doc/database/db_fcontact.md
doc/database/db_fsuggest.md
doc/database/db_group.md
doc/database/db_group_member.md
doc/database/db_gserver-tag.md
doc/database/db_gserver.md
doc/database/db_hook.md
doc/database/db_host.md
doc/database/db_inbox-status.md
doc/database/db_intro.md
doc/database/db_item-uri.md
doc/database/db_locks.md
doc/database/db_mail.md
doc/database/db_mailacct.md
doc/database/db_manage.md
doc/database/db_notification.md
doc/database/db_notify-threads.md
doc/database/db_notify.md
doc/database/db_oembed.md
doc/database/db_openwebauth-token.md
doc/database/db_parsed_url.md
doc/database/db_pconfig.md
doc/database/db_permissionset.md
doc/database/db_photo.md
doc/database/db_post-category.md
doc/database/db_post-content.md
doc/database/db_post-delivery-data.md
doc/database/db_post-media.md
doc/database/db_post-tag.md
doc/database/db_post-thread-user.md
doc/database/db_post-thread.md
doc/database/db_post-user-notification.md
doc/database/db_post-user.md
doc/database/db_post.md
doc/database/db_process.md
doc/database/db_profile.md
doc/database/db_profile_check.md
doc/database/db_profile_field.md
doc/database/db_push_subscriber.md
doc/database/db_register.md
doc/database/db_search.md
doc/database/db_session.md
doc/database/db_storage.md
doc/database/db_tag.md
doc/database/db_tokens.md
doc/database/db_user-contact.md
doc/database/db_user.md
doc/database/db_userd.md
doc/database/db_verb.md
doc/database/db_worker-ipc.md
doc/database/db_workerqueue.md
src/Database/DBStructure.php
view/templates/structure.tpl

index 6dba89bf41fa1f06185a9e5bf0df4b7dbcf7537b..dd977350352f6d830a0531e6ea27027a29593be3 100644 (file)
@@ -3,6 +3,9 @@ Table 2fa_app_specific_password
 
 Two-factor app-specific _password
 
+Fields
+------
+
 | Field           | Description                              | Type               | Null | Key | Default | Extra          |
 | --------------- | ---------------------------------------- | ------------------ | ---- | --- | ------- | -------------- |
 | id              | Password ID for revocation               | mediumint unsigned | NO   | PRI | NULL    | auto_increment |
@@ -12,4 +15,19 @@ Two-factor app-specific _password
 | generated       | Datetime the password was generated      | datetime           | NO   |     | NULL    |                |
 | last_used       | Datetime the password was last used      | datetime           | YES  |     | NULL    |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_description | uid, description(190) |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 30e00ef658b8ee054d0dd35bcd6abb1d5a1a07ef..53574c754113cae4620e4061e799755fbaae3b60 100644 (file)
@@ -3,6 +3,9 @@ Table 2fa_recovery_codes
 
 Two-factor authentication recovery codes
 
+Fields
+------
+
 | Field     | Description                     | Type               | Null | Key | Default | Extra |
 | --------- | ------------------------------- | ------------------ | ---- | --- | ------- | ----- |
 | uid       | User ID                         | mediumint unsigned | NO   | PRI | NULL    |       |
@@ -10,4 +13,18 @@ Two-factor authentication recovery codes
 | generated | Datetime the code was generated | datetime           | NO   |     | NULL    |       |
 | used      | Datetime the code was used      | datetime           | YES  |     | NULL    |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uid, code |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 34845ba5794a6d5a19e4b78eec6b68ba1d6d35b6..595d0ef5c7d1e12d2b96acc6808ee9ecb13d7fdf 100644 (file)
@@ -3,6 +3,9 @@ Table 2fa_trusted_browser
 
 Two-factor authentication trusted browsers
 
+Fields
+------
+
 | Field       | Description                                | Type               | Null | Key | Default | Extra |
 | ----------- | ------------------------------------------ | ------------------ | ---- | --- | ------- | ----- |
 | cookie_hash | Trusted cookie hash                        | varchar(80)        | NO   | PRI | NULL    |       |
@@ -11,4 +14,19 @@ Two-factor authentication trusted browsers
 | created     | Datetime the trusted browser was recorded  | datetime           | NO   |     | NULL    |       |
 | last_used   | Datetime the trusted browser was last used | datetime           | YES  |     | NULL    |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | cookie_hash |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 568e64a5a66063bf8658659f7b620758ce1bc90d..6644ebaa2a2eb8ac46558040d509a356ed9c28f0 100644 (file)
@@ -3,6 +3,9 @@ Table addon
 
 registered addons
 
+Fields
+------
+
 | Field        | Description                                   | Type         | Null | Key | Default | Extra          |
 | ------------ | --------------------------------------------- | ------------ | ---- | --- | ------- | -------------- |
 | id           |                                               | int unsigned | NO   | PRI | NULL    | auto_increment |
@@ -13,4 +16,14 @@ registered addons
 | timestamp    | file timestamp to check for reloads           | int unsigned | NO   |     | 0       |                |
 | plugin_admin | 1 = has admin config, 0 = has no admin config | boolean      | NO   |     | 0       |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| installed_name | installed, name |
+| name | UNIQUE, name |
+
+
 Return to [database documentation](help/database)
index c76c99b8b3d12fde50d03681f45f99a4427f5199..a7ea4e9d4c371ede7e7df5ad562b92553800bfe3 100644 (file)
@@ -3,6 +3,9 @@ Table apcontact
 
 ActivityPub compatible contacts - used in the ActivityPub implementation
 
+Fields
+------
+
 | Field            | Description                  | Type           | Null | Key | Default             | Extra |
 | ---------------- | ---------------------------- | -------------- | ---- | --- | ------------------- | ----- |
 | url              | URL of the contact           | varbinary(255) | NO   | PRI | NULL                |       |
@@ -30,4 +33,24 @@ ActivityPub compatible contacts - used in the ActivityPub implementation
 | statuses_count   | Number of posts              | int unsigned   | YES  |     | 0                   |       |
 | updated          |                              | datetime       | NO   |     | 0001-01-01 00:00:00 |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | url |
+| addr | addr(32) |
+| alias | alias(190) |
+| followers | followers(190) |
+| baseurl | baseurl(190) |
+| sharedinbox | sharedinbox(190) |
+| gsid | gsid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| gsid | [gserver](help/database/db_gserver) | id |
+
 Return to [database documentation](help/database)
index e37bce6c9f5d7d26cadb6d048ac25ff5e0e28907..19230b10b0779e95dc235a5f205d15a9073e322f 100644 (file)
@@ -3,6 +3,9 @@ Table application-token
 
 OAuth user token
 
+Fields
+------
+
 | Field          | Description   | Type               | Null | Key | Default | Extra |
 | -------------- | ------------- | ------------------ | ---- | --- | ------- | ----- |
 | application-id |               | int unsigned       | NO   | PRI | NULL    |       |
@@ -16,4 +19,20 @@ OAuth user token
 | follow         | Follow scope  | boolean            | YES  |     | NULL    |       |
 | push           | Push scope    | boolean            | YES  |     | NULL    |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | application-id, uid |
+| uid_id | uid, application-id |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| application-id | [application](help/database/db_application) | id |
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 461cc1188103caab91afd3839ddd09f88adc7fd6..e1743f28c708365f72dbbce5431b2957fb3499d1 100644 (file)
@@ -3,6 +3,9 @@ Table application
 
 OAuth application
 
+Fields
+------
+
 | Field         | Description     | Type         | Null | Key | Default | Extra          |
 | ------------- | --------------- | ------------ | ---- | --- | ------- | -------------- |
 | id            | generated index | int unsigned | NO   | PRI | NULL    | auto_increment |
@@ -17,4 +20,13 @@ OAuth application
 | follow        | Follow scope    | boolean      | YES  |     | NULL    |                |
 | push          | Push scope      | boolean      | YES  |     | NULL    |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| client_id | UNIQUE, client_id |
+
+
 Return to [database documentation](help/database)
index 4cbda2a17b5d9facc225f7ddaa916c136923d5f9..218ce8b1d7912970f7b2c7a01d2d997c40e61823 100644 (file)
@@ -3,6 +3,9 @@ Table attach
 
 file attachments
 
+Fields
+------
+
 | Field         | Description                                           | Type               | Null | Key | Default             | Extra          |
 | ------------- | ----------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id            | generated index                                       | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -21,4 +24,19 @@ file attachments
 | backend-class | Storage backend class                                 | tinytext           | YES  |     | NULL                |                |
 | backend-ref   | Storage backend data reference                        | text               | YES  |     | NULL                |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index fef3f987c1034e4552cbcf1822643dc7bfd79397..9ebd15cbdf97a68386d4a8672bdc0429e189d189 100644 (file)
@@ -3,6 +3,9 @@ Table auth_codes
 
 OAuth usage
 
+Fields
+------
+
 | Field        | Description | Type         | Null | Key | Default | Extra |
 | ------------ | ----------- | ------------ | ---- | --- | ------- | ----- |
 | id           |             | varchar(40)  | NO   | PRI | NULL    |       |
@@ -11,4 +14,19 @@ OAuth usage
 | expires      |             | int          | NO   |     | 0       |       |
 | scope        |             | varchar(250) | NO   |     |         |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| client_id | client_id |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| client_id | [clients](help/database/db_clients) | client_id |
+
 Return to [database documentation](help/database)
index 300959ef384d5c6c5e533782e1bdc38d155d9d5c..2428a6f51a1fc6722c8d30d0e8602febcd21634a 100644 (file)
@@ -3,6 +3,9 @@ Table cache
 
 Stores temporary data
 
+Fields
+------
+
 | Field   | Description                  | Type           | Null | Key | Default             | Extra |
 | ------- | ---------------------------- | -------------- | ---- | --- | ------------------- | ----- |
 | k       | cache key                    | varbinary(255) | NO   | PRI | NULL                |       |
@@ -10,4 +13,13 @@ Stores temporary data
 | expires | datetime of cache expiration | datetime       | NO   |     | 0001-01-01 00:00:00 |       |
 | updated | datetime of cache insertion  | datetime       | NO   |     | 0001-01-01 00:00:00 |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | k |
+| k_expires | k, expires |
+
+
 Return to [database documentation](help/database)
index 5988954ab8678ca2298a76c1d0395b700accbb55..bfd54c45da8e4a0fa6c5d062a5de56364c52652f 100644 (file)
@@ -3,6 +3,9 @@ Table challenge
 
 
 
+Fields
+------
+
 | Field       | Description   | Type         | Null | Key | Default | Extra          |
 | ----------- | ------------- | ------------ | ---- | --- | ------- | -------------- |
 | id          | sequential ID | int unsigned | NO   | PRI | NULL    | auto_increment |
@@ -12,4 +15,13 @@ Table challenge
 | type        |               | varchar(255) | NO   |     |         |                |
 | last_update |               | varchar(255) | NO   |     |         |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| expire | expire |
+
+
 Return to [database documentation](help/database)
index f907e0d969368579a59505a57250920fd34412de..00e5ef6c3104d75c66eff34c3243f98a060fe1bf 100644 (file)
@@ -3,6 +3,9 @@ Table clients
 
 OAuth usage
 
+Fields
+------
+
 | Field        | Description | Type               | Null | Key | Default | Extra |
 | ------------ | ----------- | ------------------ | ---- | --- | ------- | ----- |
 | client_id    |             | varchar(20)        | NO   | PRI | NULL    |       |
@@ -12,4 +15,19 @@ OAuth usage
 | icon         |             | text               | YES  |     | NULL    |       |
 | uid          | User id     | mediumint unsigned | NO   |     | 0       |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | client_id |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 029723510d6f84a64aedb45c4a666b5ad65406e5..17c3cfee2059de39ac0e7d3938dde98eed0e444c 100644 (file)
@@ -3,6 +3,9 @@ Table config
 
 main configuration storage
 
+Fields
+------
+
 | Field | Description | Type          | Null | Key | Default | Extra          |
 | ----- | ----------- | ------------- | ---- | --- | ------- | -------------- |
 | id    |             | int unsigned  | NO   | PRI | NULL    | auto_increment |
@@ -10,4 +13,13 @@ main configuration storage
 | k     |             | varbinary(50) | NO   |     |         |                |
 | v     |             | mediumtext    | YES  |     | NULL    |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| cat_k | UNIQUE, cat, k |
+
+
 Return to [database documentation](help/database)
index 9a86b8daf7b2923719b6590e223fea767a850b56..c8dc95a3b7332252d355a8e64a592264ba9847bc 100644 (file)
@@ -3,6 +3,9 @@ Table contact-relation
 
 Contact relations
 
+Fields
+------
+
 | Field            | Description                                         | Type         | Null | Key | Default             | Extra |
 | ---------------- | --------------------------------------------------- | ------------ | ---- | --- | ------------------- | ----- |
 | cid              | contact the related contact had interacted with     | int unsigned | NO   | PRI | 0                   |       |
@@ -11,4 +14,20 @@ Contact relations
 | follow-updated   | Date of the last update of the contact relationship | datetime     | NO   |     | 0001-01-01 00:00:00 |       |
 | follows          |                                                     | boolean      | NO   |     | 0                   |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | cid, relation-cid |
+| relation-cid | relation-cid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| cid | [contact](help/database/db_contact) | id |
+| relation-cid | [contact](help/database/db_contact) | id |
+
 Return to [database documentation](help/database)
index 340f95e0677bc1c78f2d8c2819df37df4a8186d7..ae49777aa378bbfda50f6045c2cacc052ca50c1c 100644 (file)
@@ -3,6 +3,9 @@ Table contact
 
 contact table
 
+Fields
+------
+
 | Field                     | Description                                               | Type               | Null | Key | Default             | Extra          |
 | ------------------------- | --------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id                        | sequential ID                                             | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -86,4 +89,41 @@ contact table
 | fetch_further_information |                                                           | tinyint unsigned   | NO   |     | 0                   |                |
 | ffi_keyword_denylist      |                                                           | text               | YES  |     | NULL                |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_name | uid, name(190) |
+| self_uid | self, uid |
+| alias_uid | alias(128), uid |
+| pending_uid | pending, uid |
+| blocked_uid | blocked, uid |
+| uid_rel_network_poll | uid, rel, network, poll(64), archive |
+| uid_network_batch | uid, network, batch(64) |
+| batch_contact-type | batch(64), contact-type |
+| addr_uid | addr(128), uid |
+| nurl_uid | nurl(128), uid |
+| nick_uid | nick(128), uid |
+| attag_uid | attag(96), uid |
+| dfrn-id | dfrn-id(64) |
+| issued-id | issued-id(64) |
+| network_uid_lastupdate | network, uid, last-update |
+| uid_network_self_lastupdate | uid, network, self, last-update |
+| uid_lastitem | uid, last-item |
+| baseurl | baseurl(64) |
+| uid_contact-type | uid, contact-type |
+| uid_self_contact-type | uid, self, contact-type |
+| self_network_uid | self, network, uid |
+| gsid | gsid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+| gsid | [gserver](help/database/db_gserver) | id |
+
 Return to [database documentation](help/database)
index 11bd7ac13d4548feb0d21be5037b906684b01897..a92e154c25fdddb03e30fd072bb04ebf78366e61 100644 (file)
@@ -3,6 +3,9 @@ Table conv
 
 private messages
 
+Fields
+------
+
 | Field   | Description                               | Type               | Null | Key | Default             | Extra          |
 | ------- | ----------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id      | sequential ID                             | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -14,4 +17,19 @@ private messages
 | updated | edited timestamp                          | datetime           | NO   |     | 0001-01-01 00:00:00 |                |
 | subject | subject of initial message                | text               | YES  |     | NULL                |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 964a98d6100220e256acc36b0d6d01d7e43bc9a8..eba69c990427e10044b2569a00d3f7214b60a09d 100644 (file)
@@ -3,6 +3,9 @@ Table conversation
 
 Raw data and structure information for messages
 
+Fields
+------
+
 | Field             | Description                                                          | Type             | Null | Key | Default             | Extra |
 | ----------------- | -------------------------------------------------------------------- | ---------------- | ---- | --- | ------------------- | ----- |
 | item-uri          | Original URI of the item - unrelated to the table with the same name | varbinary(255)   | NO   | PRI | NULL                |       |
@@ -14,4 +17,14 @@ Raw data and structure information for messages
 | source            | Original source                                                      | mediumtext       | YES  |     | NULL                |       |
 | received          | Receiving date                                                       | datetime         | NO   |     | 0001-01-01 00:00:00 |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | item-uri |
+| conversation-uri | conversation-uri |
+| received | received |
+
+
 Return to [database documentation](help/database)
index 0f1c2f5cf11e769238ec95fb7272705c0bc1e364..16c31e46e23a8a97e40b55e6d883b7d54628d381 100644 (file)
@@ -3,6 +3,9 @@ Table delayed-post
 
 Posts that are about to be distributed at a later time
 
+Fields
+------
+
 | Field   | Description                                    | Type               | Null | Key | Default | Extra          |
 | ------- | ---------------------------------------------- | ------------------ | ---- | --- | ------- | -------------- |
 | id      |                                                | int unsigned       | NO   | PRI | NULL    | auto_increment |
@@ -10,4 +13,19 @@ Posts that are about to be distributed at a later time
 | uid     | Owner User id                                  | mediumint unsigned | YES  |     | NULL    |                |
 | delayed | delay time                                     | datetime           | YES  |     | NULL    |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_uri | UNIQUE, uid, uri(190) |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 503c846fd96da8ea73d985dc37653e4aea152410..3a15a5d19c5f0d7e4c931dfc79aa221a2c9f92fc 100644 (file)
@@ -3,9 +3,26 @@ Table diaspora-interaction
 
 Signed Diaspora Interaction
 
+Fields
+------
+
 | Field       | Description                                               | Type         | Null | Key | Default | Extra |
 | ----------- | --------------------------------------------------------- | ------------ | ---- | --- | ------- | ----- |
 | uri-id      | Id of the item-uri table entry that contains the item uri | int unsigned | NO   | PRI | NULL    |       |
 | interaction | The Diaspora interaction                                  | mediumtext   | YES  |     | NULL    |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uri-id |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+
 Return to [database documentation](help/database)
index 72cec001289f01834c0fa3601415807d8a4ca3b6..6b893dafdf1e0f45a0bb84df93a880d989360bd7 100644 (file)
@@ -3,6 +3,9 @@ Table event
 
 Events
 
+Fields
+------
+
 | Field     | Description                                            | Type               | Null | Key | Default             | Extra          |
 | --------- | ------------------------------------------------------ | ------------------ | ---- | --- | ------------------- | -------------- |
 | id        | sequential ID                                          | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -26,4 +29,21 @@ Events
 | deny_cid  | Access Control - list of denied contact.id             | mediumtext         | YES  |     | NULL                |                |
 | deny_gid  | Access Control - list of denied groups                 | mediumtext         | YES  |     | NULL                |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_start | uid, start |
+| cid | cid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+| cid | [contact](help/database/db_contact) | id |
+
 Return to [database documentation](help/database)
index f20ca6cd05a10f4c9b02332d0433908f2a0ace0f..a30bfb4ee6cc4a758b6cd26240fd78897848d7bb 100644 (file)
@@ -3,6 +3,9 @@ Table fcontact
 
 Diaspora compatible contacts - used in the Diaspora implementation
 
+Fields
+------
+
 | Field    | Description   | Type             | Null | Key | Default             | Extra          |
 | -------- | ------------- | ---------------- | ---- | --- | ------------------- | -------------- |
 | id       | sequential ID | int unsigned     | NO   | PRI | NULL                | auto_increment |
@@ -23,4 +26,14 @@ Diaspora compatible contacts - used in the Diaspora implementation
 | pubkey   |               | text             | YES  |     | NULL                |                |
 | updated  |               | datetime         | NO   |     | 0001-01-01 00:00:00 |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| addr | addr(32) |
+| url | UNIQUE, url(190) |
+
+
 Return to [database documentation](help/database)
index d3a8e21ab58f40b7a1ccc9818b9d6ce589fd270a..55c36e3c1d7157bdf74ab6b12935129012b37371 100644 (file)
@@ -3,6 +3,9 @@ Table fsuggest
 
 friend suggestion stuff
 
+Fields
+------
+
 | Field   | Description | Type               | Null | Key | Default             | Extra          |
 | ------- | ----------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id      |             | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -15,4 +18,21 @@ friend suggestion stuff
 | note    |             | text               | YES  |     | NULL                |                |
 | created |             | datetime           | NO   |     | 0001-01-01 00:00:00 |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| cid | cid |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+| cid | [contact](help/database/db_contact) | id |
+
 Return to [database documentation](help/database)
index 7ea3a0d2ffff09a2a561f4ea1c9bee110f06746a..48565aaeea2b1dbf1380b9b8d2af537f5d696061 100644 (file)
@@ -3,6 +3,9 @@ Table group
 
 privacy groups, group info
 
+Fields
+------
+
 | Field   | Description                                | Type               | Null | Key | Default | Extra          |
 | ------- | ------------------------------------------ | ------------------ | ---- | --- | ------- | -------------- |
 | id      | sequential ID                              | int unsigned       | NO   | PRI | NULL    | auto_increment |
@@ -11,4 +14,19 @@ privacy groups, group info
 | deleted | 1 indicates the group has been deleted     | boolean            | NO   |     | 0       |                |
 | name    | human readable name of group               | varchar(255)       | NO   |     |         |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index ba0960df446eab1cd262ea610d86aea430a1ac33..adebe933bd3d9e7a10e12b5e690dadbd5ed2ba28 100644 (file)
@@ -3,10 +3,30 @@ Table group_member
 
 privacy groups, member info
 
+Fields
+------
+
 | Field      | Description                                               | Type         | Null | Key | Default | Extra          |
 | ---------- | --------------------------------------------------------- | ------------ | ---- | --- | ------- | -------------- |
 | id         | sequential ID                                             | int unsigned | NO   | PRI | NULL    | auto_increment |
 | gid        | groups.id of the associated group                         | int unsigned | NO   |     | 0       |                |
 | contact-id | contact.id of the member assigned to the associated group | int unsigned | NO   |     | 0       |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| contactid | contact-id |
+| gid_contactid | UNIQUE, gid, contact-id |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| gid | [group](help/database/db_group) | id |
+| contact-id | [contact](help/database/db_contact) | id |
+
 Return to [database documentation](help/database)
index dba65c45aba5d220e95bc566f6d42d851f6fdaa8..216bef1d568abb76f6c6fd72b8a66e467589df20 100644 (file)
@@ -3,9 +3,27 @@ Table gserver-tag
 
 Tags that the server has subscribed
 
+Fields
+------
+
 | Field      | Description                        | Type         | Null | Key | Default | Extra |
 | ---------- | ---------------------------------- | ------------ | ---- | --- | ------- | ----- |
 | gserver-id | The id of the gserver              | int unsigned | NO   | PRI | 0       |       |
 | tag        | Tag that the server has subscribed | varchar(100) | NO   | PRI |         |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | gserver-id, tag |
+| tag | tag |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| gserver-id | [gserver](help/database/db_gserver) | id |
+
 Return to [database documentation](help/database)
index 341f71eff5a68a108162df9ae5f8cd9a04c4d3bd..5d5f2226b340d2ea29b74f4ddda16e702d35dd83 100644 (file)
@@ -3,6 +3,9 @@ Table gserver
 
 Global servers
 
+Fields
+------
+
 | Field            | Description                                        | Type             | Null | Key | Default             | Extra          |
 | ---------------- | -------------------------------------------------- | ---------------- | ---- | --- | ------------------- | -------------- |
 | id               | sequential ID                                      | int unsigned     | NO   | PRI | NULL                | auto_increment |
@@ -29,4 +32,15 @@ Global servers
 | failed           | Connection failed                                  | boolean          | YES  |     | NULL                |                |
 | next_contact     | Next connection request                            | datetime         | YES  |     | 0001-01-01 00:00:00 |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| nurl | UNIQUE, nurl(190) |
+| next_contact | next_contact |
+| network | network |
+
+
 Return to [database documentation](help/database)
index c25f674cc9ae9c3b50f5b0c5b8de89e81eac8838..500e8f91d0d8956da05e268bc5ac6f6066c1dcf0 100644 (file)
@@ -3,6 +3,9 @@ Table hook
 
 addon hook registry
 
+Fields
+------
+
 | Field    | Description                                                                                                | Type              | Null | Key | Default | Extra          |
 | -------- | ---------------------------------------------------------------------------------------------------------- | ----------------- | ---- | --- | ------- | -------------- |
 | id       | sequential ID                                                                                              | int unsigned      | NO   | PRI | NULL    | auto_increment |
@@ -11,4 +14,14 @@ addon hook registry
 | function | function name of hook handler                                                                              | varbinary(200)    | NO   |     |         |                |
 | priority | not yet implemented - can be used to sort conflicts in hook handling by calling handlers in priority order | smallint unsigned | NO   |     | 0       |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| priority | priority |
+| hook_file_function | UNIQUE, hook, file, function |
+
+
 Return to [database documentation](help/database)
index 97fda6fa6f24dd63bda0cb988bcabb4c1b380198..802001e1b1920419c8b817ad745b10be608eb433 100644 (file)
@@ -3,9 +3,21 @@ Table host
 
 Hostname
 
+Fields
+------
+
 | Field | Description   | Type             | Null | Key | Default | Extra          |
 | ----- | ------------- | ---------------- | ---- | --- | ------- | -------------- |
 | id    | sequential ID | tinyint unsigned | NO   | PRI | NULL    | auto_increment |
 | name  | The hostname  | varchar(128)     | NO   |     |         |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| name | UNIQUE, name |
+
+
 Return to [database documentation](help/database)
index fb6a40850679df5ca9b29630ba07b2bdca8541cb..1f3463ad4b20d7012ad42fba8d95293a64a1eddc 100644 (file)
@@ -3,6 +3,9 @@ Table inbox-status
 
 Status of ActivityPub inboxes
 
+Fields
+------
+
 | Field    | Description                          | Type           | Null | Key | Default             | Extra |
 | -------- | ------------------------------------ | -------------- | ---- | --- | ------------------- | ----- |
 | url      | URL of the inbox                     | varbinary(255) | NO   | PRI | NULL                |       |
@@ -13,4 +16,12 @@ Status of ActivityPub inboxes
 | archive  | Is the inbox archived?               | boolean        | NO   |     | 0                   |       |
 | shared   | Is it a shared inbox?                | boolean        | NO   |     | 0                   |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | url |
+
+
 Return to [database documentation](help/database)
index 3e3731b55a2af78a140a74ca7e3742fad3f6093b..ed4dd54b690ba9b5eb4365d98957b50470ab0fa0 100644 (file)
@@ -3,6 +3,9 @@ Table intro
 
 
 
+Fields
+------
+
 | Field      | Description   | Type               | Null | Key | Default             | Extra          |
 | ---------- | ------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id         | sequential ID | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -17,4 +20,21 @@ Table intro
 | blocked    |               | boolean            | NO   |     | 1                   |                |
 | ignore     |               | boolean            | NO   |     | 0                   |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| contact-id | contact-id |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+| contact-id | [contact](help/database/db_contact) | id |
+
 Return to [database documentation](help/database)
index 4b3dda5cedec747980ad362a0d94dfc874fc6952..3ce86fca1644e893b64a7828ba5fb2d45cc4faea 100644 (file)
@@ -3,10 +3,23 @@ Table item-uri
 
 URI and GUID for items
 
+Fields
+------
+
 | Field | Description                     | Type           | Null | Key | Default | Extra          |
 | ----- | ------------------------------- | -------------- | ---- | --- | ------- | -------------- |
 | id    |                                 | int unsigned   | NO   | PRI | NULL    | auto_increment |
 | uri   | URI of an item                  | varbinary(255) | NO   |     | NULL    |                |
 | guid  | A unique identifier for an item | varbinary(255) | YES  |     | NULL    |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uri | UNIQUE, uri |
+| guid | guid |
+
+
 Return to [database documentation](help/database)
index 337999017462774d8f58d3009edce06ce30dca23..92d3e6434ffabe2682a6adb04a7c72778b02eb1e 100644 (file)
@@ -3,6 +3,9 @@ Table locks
 
 
 
+Fields
+------
+
 | Field   | Description                  | Type         | Null | Key | Default             | Extra          |
 | ------- | ---------------------------- | ------------ | ---- | --- | ------------------- | -------------- |
 | id      | sequential ID                | int unsigned | NO   | PRI | NULL                | auto_increment |
@@ -11,4 +14,13 @@ Table locks
 | pid     | Process ID                   | int unsigned | NO   |     | 0                   |                |
 | expires | datetime of cache expiration | datetime     | NO   |     | 0001-01-01 00:00:00 |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| name_expires | name, expires |
+
+
 Return to [database documentation](help/database)
index dbdacb6d316821bf75b256b0efdb794205cd2dcc..685dd2a0f389128b1d763d0d1cdcb9707b76d042 100644 (file)
@@ -3,6 +3,9 @@ Table mail
 
 private messages
 
+Fields
+------
+
 | Field         | Description                                                    | Type               | Null | Key | Default             | Extra          |
 | ------------- | -------------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id            | sequential ID                                                  | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -28,4 +31,31 @@ private messages
 | thr-parent-id | Id of the item-uri table that contains the thread parent uri   | int unsigned       | YES  |     | NULL                |                |
 | created       | creation time of the private message                           | datetime           | NO   |     | 0001-01-01 00:00:00 |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_seen | uid, seen |
+| convid | convid |
+| uri | uri(64) |
+| parent-uri | parent-uri(64) |
+| contactid | contact-id(32) |
+| author-id | author-id |
+| uri-id | uri-id |
+| parent-uri-id | parent-uri-id |
+| thr-parent-id | thr-parent-id |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+| author-id | [contact](help/database/db_contact) | id |
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+| parent-uri-id | [item-uri](help/database/db_item-uri) | id |
+| thr-parent-id | [item-uri](help/database/db_item-uri) | id |
+
 Return to [database documentation](help/database)
index 8a1f3807884844af25a6da060116cc0d8518d33a..aaa0fa877d1e886d79a58877b50570d8b92fc34e 100644 (file)
@@ -3,6 +3,9 @@ Table mailacct
 
 Mail account data for fetching mails
 
+Fields
+------
+
 | Field        | Description   | Type               | Null | Key | Default             | Extra          |
 | ------------ | ------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id           | sequential ID | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -19,4 +22,19 @@ Mail account data for fetching mails
 | pubmail      |               | boolean            | NO   |     | 0                   |                |
 | last_check   |               | datetime           | NO   |     | 0001-01-01 00:00:00 |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index c2dadfca4d94ac7df1549e23b5efbdb135f0dafa..53e5a35bb93c502b80f56e3e9db290b11128a41d 100644 (file)
@@ -3,10 +3,30 @@ Table manage
 
 table of accounts that can manage each other
 
+Fields
+------
+
 | Field | Description   | Type               | Null | Key | Default | Extra          |
 | ----- | ------------- | ------------------ | ---- | --- | ------- | -------------- |
 | id    | sequential ID | int unsigned       | NO   | PRI | NULL    | auto_increment |
 | uid   | User id       | mediumint unsigned | NO   |     | 0       |                |
 | mid   | User id       | mediumint unsigned | NO   |     | 0       |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_mid | UNIQUE, uid, mid |
+| mid | mid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+| mid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 0941ff1d36c5bfe33f6d69efe8f350e0f67683de..4de2a53bf792991f0cb300b5e098d708923f8445 100644 (file)
@@ -3,6 +3,9 @@ Table notification
 
 notifications
 
+Fields
+------
+
 | Field         | Description                                                                    | Type               | Null | Key | Default | Extra          |
 | ------------- | ------------------------------------------------------------------------------ | ------------------ | ---- | --- | ------- | -------------- |
 | id            | sequential ID                                                                  | int unsigned       | NO   | PRI | NULL    | auto_increment |
@@ -15,4 +18,28 @@ notifications
 | created       |                                                                                | datetime           | YES  |     | NULL    |                |
 | seen          |                                                                                | boolean            | YES  |     | 0       |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_vid_type_actor-id_target-uri-id | UNIQUE, uid, vid, type, actor-id, target-uri-id |
+| vid | vid |
+| actor-id | actor-id |
+| target-uri-id | target-uri-id |
+| parent-uri-id | parent-uri-id |
+| seen_uid | seen, uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+| vid | [verb](help/database/db_verb) | id |
+| actor-id | [contact](help/database/db_contact) | id |
+| target-uri-id | [item-uri](help/database/db_item-uri) | id |
+| parent-uri-id | [item-uri](help/database/db_item-uri) | id |
+
 Return to [database documentation](help/database)
index 0dd493975b72a013c01e1691dfd5c51840b7e6b7..a58c45dabdb8ebfebc71f9001472ffda0982e1a5 100644 (file)
@@ -3,6 +3,9 @@ Table notify-threads
 
 
 
+Fields
+------
+
 | Field                | Description                                   | Type               | Null | Key | Default | Extra          |
 | -------------------- | --------------------------------------------- | ------------------ | ---- | --- | ------- | -------------- |
 | id                   | sequential ID                                 | int unsigned       | NO   | PRI | NULL    | auto_increment |
@@ -12,4 +15,23 @@ Table notify-threads
 | parent-item          |                                               | int unsigned       | NO   |     | 0       |                |
 | receiver-uid         | User id                                       | mediumint unsigned | NO   |     | 0       |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| master-parent-uri-id | master-parent-uri-id |
+| receiver-uid | receiver-uid |
+| notify-id | notify-id |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| notify-id | [notify](help/database/db_notify) | id |
+| master-parent-uri-id | [item-uri](help/database/db_item-uri) | id |
+| receiver-uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index a9eac5a3c8ad37f4e88d292b047c81abd10e9d52..338425ac967b989bb2ca24f5efadcce3ea7f3a12 100644 (file)
@@ -3,6 +3,9 @@ Table notify
 
 notifications
 
+Fields
+------
+
 | Field         | Description                                   | Type               | Null | Key | Default             | Extra          |
 | ------------- | --------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id            | sequential ID                                 | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -24,4 +27,25 @@ notifications
 | name_cache    | Cached bbcode parsing of name                 | tinytext           | YES  |     | NULL                |                |
 | msg_cache     | Cached bbcode parsing of msg                  | mediumtext         | YES  |     | NULL                |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| seen_uid_date | seen, uid, date |
+| uid_date | uid, date |
+| uid_type_link | uid, type, link(190) |
+| uri-id | uri-id |
+| parent-uri-id | parent-uri-id |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+| parent-uri-id | [item-uri](help/database/db_item-uri) | id |
+
 Return to [database documentation](help/database)
index 3edee64c688ea4fdf7a8c8d23d7ac83c7c103bef..86b23f70f91154efc98367e71d28c6eb05b79349 100644 (file)
@@ -3,6 +3,9 @@ Table oembed
 
 cache for OEmbed queries
 
+Fields
+------
+
 | Field    | Description                    | Type               | Null | Key | Default             | Extra |
 | -------- | ------------------------------ | ------------------ | ---- | --- | ------------------- | ----- |
 | url      | page url                       | varbinary(255)     | NO   | PRI | NULL                |       |
@@ -10,4 +13,13 @@ cache for OEmbed queries
 | content  | OEmbed data of the page        | mediumtext         | YES  |     | NULL                |       |
 | created  | datetime of creation           | datetime           | NO   |     | 0001-01-01 00:00:00 |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | url, maxwidth |
+| created | created |
+
+
 Return to [database documentation](help/database)
index 1c3060f0f4cb5ceb9fc8f14171f0442104e2c192..ad598087e9e23c0dfec2b4c42c951edd9806d87a 100644 (file)
@@ -3,6 +3,9 @@ Table openwebauth-token
 
 Store OpenWebAuth token to verify contacts
 
+Fields
+------
+
 | Field   | Description                | Type               | Null | Key | Default             | Extra          |
 | ------- | -------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id      | sequential ID              | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -12,4 +15,19 @@ Store OpenWebAuth token to verify contacts
 | meta    |                            | varchar(255)       | NO   |     |                     |                |
 | created | datetime of creation       | datetime           | NO   |     | 0001-01-01 00:00:00 |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 29a3ff85213d136ae65bee39f15a483ded51b0b4..8101883a36856a5f470445941d36f37c23683c44 100644 (file)
@@ -3,6 +3,9 @@ Table parsed_url
 
 cache for &#039;parse_url&#039; queries
 
+Fields
+------
+
 | Field    | Description                       | Type       | Null | Key | Default             | Extra |
 | -------- | --------------------------------- | ---------- | ---- | --- | ------------------- | ----- |
 | url_hash | page url hash                     | binary(64) | NO   | PRI | NULL                |       |
@@ -13,4 +16,14 @@ cache for &#039;parse_url&#039; queries
 | created  | datetime of creation              | datetime   | NO   |     | 0001-01-01 00:00:00 |       |
 | expires  | datetime of expiration            | datetime   | NO   |     | 0001-01-01 00:00:00 |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | url_hash, guessing, oembed |
+| created | created |
+| expires | expires |
+
+
 Return to [database documentation](help/database)
index 7449c511d36189d58b11303dc2ad0f4143938bef..2de6dd294cf64d57578853e13c85c045d1b5c2de 100644 (file)
@@ -3,6 +3,9 @@ Table pconfig
 
 personal (per user) configuration storage
 
+Fields
+------
+
 | Field | Description | Type               | Null | Key | Default | Extra          |
 | ----- | ----------- | ------------------ | ---- | --- | ------- | -------------- |
 | id    | Primary key | int unsigned       | NO   | PRI | NULL    | auto_increment |
@@ -11,4 +14,19 @@ personal (per user) configuration storage
 | k     | Key         | varchar(100)       | NO   |     |         |                |
 | v     | Value       | mediumtext         | YES  |     | NULL    |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_cat_k | UNIQUE, uid, cat, k |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 855ed1ea12684ccc6c49583d6129ac3e4f1a5a7f..421c67abb351ff994bbb7bc9129c97593500e5bd 100644 (file)
@@ -3,6 +3,9 @@ Table permissionset
 
 
 
+Fields
+------
+
 | Field     | Description                                            | Type               | Null | Key | Default | Extra          |
 | --------- | ------------------------------------------------------ | ------------------ | ---- | --- | ------- | -------------- |
 | id        | sequential ID                                          | int unsigned       | NO   | PRI | NULL    | auto_increment |
@@ -12,4 +15,19 @@ Table permissionset
 | deny_cid  | Access Control - list of denied contact.id             | mediumtext         | YES  |     | NULL    |                |
 | deny_gid  | Access Control - list of denied groups                 | mediumtext         | YES  |     | NULL    |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_allow_cid_allow_gid_deny_cid_deny_gid | uid, allow_cid(50), allow_gid(30), deny_cid(50), deny_gid(30) |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 168797a1fb09c88df963670538a4a376495e0599..5f98e4e3496370e15872e2ed8ed71a821f5f4e6c 100644 (file)
@@ -3,6 +3,9 @@ Table photo
 
 photo storage
 
+Fields
+------
+
 | Field         | Description                                            | Type               | Null | Key | Default             | Extra          |
 | ------------- | ------------------------------------------------------ | ------------------ | ---- | --- | ------------------- | -------------- |
 | id            | sequential ID                                          | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -33,4 +36,25 @@ photo storage
 | backend-ref   | Storage backend data reference                         | text               | YES  |     | NULL                |                |
 | updated       |                                                        | datetime           | NO   |     | 0001-01-01 00:00:00 |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| contactid | contact-id |
+| uid_contactid | uid, contact-id |
+| uid_profile | uid, profile |
+| uid_album_scale_created | uid, album(32), scale, created |
+| uid_album_resource-id_created | uid, album(32), resource-id, created |
+| resource-id | resource-id |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+| contact-id | [contact](help/database/db_contact) | id |
+
 Return to [database documentation](help/database)
index 14663cf5bbfe9048987909d12853202a26675c84..77e9ed679f32fcad429846cd554e90b004a5f282 100644 (file)
@@ -3,6 +3,9 @@ Table post-category
 
 post relation to categories
 
+Fields
+------
+
 | Field  | Description                                               | Type               | Null | Key | Default | Extra |
 | ------ | --------------------------------------------------------- | ------------------ | ---- | --- | ------- | ----- |
 | uri-id | Id of the item-uri table entry that contains the item uri | int unsigned       | NO   | PRI | NULL    |       |
@@ -10,4 +13,22 @@ post relation to categories
 | type   |                                                           | tinyint unsigned   | NO   | PRI | 0       |       |
 | tid    |                                                           | int unsigned       | NO   | PRI | 0       |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uri-id, uid, type, tid |
+| uri-id | tid |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+| uid | [user](help/database/db_user) | uid |
+| tid | [tag](help/database/db_tag) | id |
+
 Return to [database documentation](help/database)
index 4596a04a5601c3468a410dcd83c403432422cd94..5b8b258ec71bfaea5fda2756f41611d3910bfb6e 100644 (file)
@@ -3,6 +3,9 @@ Table post-content
 
 Content for all posts
 
+Fields
+------
+
 | Field           | Description                                                                                                               | Type         | Null | Key | Default | Extra |
 | --------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------ | ---- | --- | ------- | ----- |
 | uri-id          | Id of the item-uri table entry that contains the item uri                                                                 | int unsigned | NO   | PRI | NULL    |       |
@@ -23,4 +26,21 @@ Content for all posts
 | resource-id     | Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type | varchar(32)  | NO   |     |         |       |
 | plink           | permalink or URL to a displayable copy of the message at its source                                                       | varchar(255) | NO   |     |         |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uri-id |
+| plink | plink(191) |
+| resource-id | resource-id |
+| title-content-warning-body | FULLTEXT, title, content-warning, body |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+
 Return to [database documentation](help/database)
index 1ed912d8bc7b7e43451d097d4a6a5879bfc019f1..61f8b75de57470ea3b97f319859207c605c576b4 100644 (file)
@@ -3,6 +3,9 @@ Table post-delivery-data
 
 Delivery data for items
 
+Fields
+------
+
 | Field        | Description                                                                                                                                                | Type         | Null | Key | Default | Extra |
 | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ---- | --- | ------- | ----- |
 | uri-id       | Id of the item-uri table entry that contains the item uri                                                                                                  | int unsigned | NO   | PRI | NULL    |       |
@@ -17,4 +20,18 @@ Delivery data for items
 | diaspora     | Number of successful deliveries via Diaspora                                                                                                               | mediumint    | NO   |     | 0       |       |
 | ostatus      | Number of successful deliveries via OStatus                                                                                                                | mediumint    | NO   |     | 0       |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uri-id |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+
 Return to [database documentation](help/database)
index e1e299f02e686442ca5ab7eac735d76f3b8d447c..ef599ed1357b733fbed8b05144b9b431d0ab4a68 100644 (file)
@@ -3,6 +3,9 @@ Table post-media
 
 Attached media
 
+Fields
+------
+
 | Field           | Description                                               | Type              | Null | Key | Default | Extra          |
 | --------------- | --------------------------------------------------------- | ----------------- | ---- | --- | ------- | -------------- |
 | id              | sequential ID                                             | int unsigned      | NO   | PRI | NULL    | auto_increment |
@@ -25,4 +28,19 @@ Attached media
 | publisher-name  | Name of the publisher of the media                        | varchar(255)      | YES  |     | NULL    |                |
 | publisher-image | Image of the publisher of the media                       | varbinary(255)    | YES  |     | NULL    |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uri-id-url | UNIQUE, uri-id, url |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+
 Return to [database documentation](help/database)
index 228f27708ddf7fdf1a094552d1cc4c7320e79a3b..30e513cab4ca96d254274c25a4b0c93d5a36ddfe 100644 (file)
@@ -3,6 +3,9 @@ Table post-tag
 
 post relation to tags
 
+Fields
+------
+
 | Field  | Description                                               | Type             | Null | Key | Default | Extra |
 | ------ | --------------------------------------------------------- | ---------------- | ---- | --- | ------- | ----- |
 | uri-id | Id of the item-uri table entry that contains the item uri | int unsigned     | NO   | PRI | NULL    |       |
@@ -10,4 +13,22 @@ post relation to tags
 | tid    |                                                           | int unsigned     | NO   | PRI | 0       |       |
 | cid    | Contact id of the mentioned public contact                | int unsigned     | NO   | PRI | 0       |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uri-id, type, tid, cid |
+| tid | tid |
+| cid | cid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+| tid | [tag](help/database/db_tag) | id |
+| cid | [contact](help/database/db_contact) | id |
+
 Return to [database documentation](help/database)
index 29e5617d35519600bbdd9b932dd4fd419fc38c3e..875aee4aa1d6a30f907d24f8823675455b8a9c0d 100644 (file)
@@ -3,6 +3,9 @@ Table post-thread-user
 
 Thread related data per user
 
+Fields
+------
+
 | Field        | Description                                                                                             | Type               | Null | Key | Default             | Extra |
 | ------------ | ------------------------------------------------------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | ----- |
 | uri-id       | Id of the item-uri table entry that contains the item uri                                               | int unsigned       | NO   | PRI | NULL                |       |
@@ -29,4 +32,39 @@ Thread related data per user
 | psid         | ID of the permission set of this post                                                                   | int unsigned       | YES  |     | NULL                |       |
 | post-user-id | Id of the post-user table                                                                               | int unsigned       | YES  |     | NULL                |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uid, uri-id |
+| uri-id | uri-id |
+| owner-id | owner-id |
+| author-id | author-id |
+| causer-id | causer-id |
+| uid | uid |
+| contact-id | contact-id |
+| psid | psid |
+| post-user-id | post-user-id |
+| commented | commented |
+| uid_received | uid, received |
+| uid_pinned | uid, pinned |
+| uid_commented | uid, commented |
+| uid_starred | uid, starred |
+| uid_mention | uid, mention |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+| owner-id | [contact](help/database/db_contact) | id |
+| author-id | [contact](help/database/db_contact) | id |
+| causer-id | [contact](help/database/db_contact) | id |
+| uid | [user](help/database/db_user) | uid |
+| contact-id | [contact](help/database/db_contact) | id |
+| psid | [permissionset](help/database/db_permissionset) | id |
+| post-user-id | [post-user](help/database/db_post-user) | id |
+
 Return to [database documentation](help/database)
index 8b847e628303f3c78e21f26bc276156dc56b502b..f5a8516500a9dfba49769a476ed39bcbc843fe5d 100644 (file)
@@ -3,6 +3,9 @@ Table post-thread
 
 Thread related data
 
+Fields
+------
+
 | Field     | Description                                                                                             | Type         | Null | Key | Default             | Extra |
 | --------- | ------------------------------------------------------------------------------------------------------- | ------------ | ---- | --- | ------------------- | ----- |
 | uri-id    | Id of the item-uri table entry that contains the item uri                                               | int unsigned | NO   | PRI | NULL                |       |
@@ -15,4 +18,26 @@ Thread related data
 | changed   | Date that something in the conversation changed, indicating clients should fetch the conversation again | datetime     | NO   |     | 0001-01-01 00:00:00 |       |
 | commented |                                                                                                         | datetime     | NO   |     | 0001-01-01 00:00:00 |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uri-id |
+| owner-id | owner-id |
+| author-id | author-id |
+| causer-id | causer-id |
+| received | received |
+| commented | commented |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+| owner-id | [contact](help/database/db_contact) | id |
+| author-id | [contact](help/database/db_contact) | id |
+| causer-id | [contact](help/database/db_contact) | id |
+
 Return to [database documentation](help/database)
index 1607ce2c2394246ef5527acd5b04863e33fd1822..0ebe8ccaf1d722b90a97026783dd5f4b28d24592 100644 (file)
@@ -3,10 +3,29 @@ Table post-user-notification
 
 User post notifications
 
+Fields
+------
+
 | Field             | Description                                               | Type               | Null | Key | Default | Extra |
 | ----------------- | --------------------------------------------------------- | ------------------ | ---- | --- | ------- | ----- |
 | uri-id            | Id of the item-uri table entry that contains the item uri | int unsigned       | NO   | PRI | NULL    |       |
 | uid               | Owner id which owns this copy of the item                 | mediumint unsigned | NO   | PRI | NULL    |       |
 | notification-type |                                                           | tinyint unsigned   | NO   |     | 0       |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uid, uri-id |
+| uri-id | uri-id |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 8fad8056ecccce302bc8e2afc97bfed752449791..6d2f0c71b6c9f4e602e0b268b03cc174c9b41cbc 100644 (file)
@@ -3,6 +3,9 @@ Table post-user
 
 User specific post data
 
+Fields
+------
+
 | Field             | Description                                                                       | Type               | Null | Key | Default             | Extra          |
 | ----------------- | --------------------------------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id                |                                                                                   | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -36,4 +39,48 @@ User specific post data
 | origin            | item originated at this site                                                      | boolean            | NO   |     | 0                   |                |
 | psid              | ID of the permission set of this post                                             | int unsigned       | YES  |     | NULL                |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_uri-id | UNIQUE, uid, uri-id |
+| uri-id | uri-id |
+| parent-uri-id | parent-uri-id |
+| thr-parent-id | thr-parent-id |
+| external-id | external-id |
+| owner-id | owner-id |
+| author-id | author-id |
+| causer-id | causer-id |
+| vid | vid |
+| contact-id | contact-id |
+| event-id | event-id |
+| psid | psid |
+| author-id_uid | author-id, uid |
+| author-id_received | author-id, received |
+| parent-uri-id_uid | parent-uri-id, uid |
+| uid_contactid | uid, contact-id |
+| uid_unseen_contactid | uid, unseen, contact-id |
+| uid_unseen | uid, unseen |
+| uid_hidden_uri-id | uid, hidden, uri-id |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+| parent-uri-id | [item-uri](help/database/db_item-uri) | id |
+| thr-parent-id | [item-uri](help/database/db_item-uri) | id |
+| external-id | [item-uri](help/database/db_item-uri) | id |
+| owner-id | [contact](help/database/db_contact) | id |
+| author-id | [contact](help/database/db_contact) | id |
+| causer-id | [contact](help/database/db_contact) | id |
+| vid | [verb](help/database/db_verb) | id |
+| uid | [user](help/database/db_user) | uid |
+| contact-id | [contact](help/database/db_contact) | id |
+| event-id | [event](help/database/db_event) | id |
+| psid | [permissionset](help/database/db_permissionset) | id |
+
 Return to [database documentation](help/database)
index afde2ef8717572f42989cbcaa433baf3637408ca..7d5d7cc567ed4fc9bfe83f756b5c85ee803f614a 100644 (file)
@@ -3,6 +3,9 @@ Table post
 
 Structure for all posts
 
+Fields
+------
+
 | Field         | Description                                                                       | Type              | Null | Key | Default             | Extra |
 | ------------- | --------------------------------------------------------------------------------- | ----------------- | ---- | --- | ------------------- | ----- |
 | uri-id        | Id of the item-uri table entry that contains the item uri                         | int unsigned      | NO   | PRI | NULL                |       |
@@ -24,4 +27,32 @@ Structure for all posts
 | visible       |                                                                                   | boolean           | NO   |     | 0                   |       |
 | deleted       | item has been marked for deletion                                                 | boolean           | NO   |     | 0                   |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uri-id |
+| parent-uri-id | parent-uri-id |
+| thr-parent-id | thr-parent-id |
+| external-id | external-id |
+| owner-id | owner-id |
+| author-id | author-id |
+| causer-id | causer-id |
+| vid | vid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uri-id | [item-uri](help/database/db_item-uri) | id |
+| parent-uri-id | [item-uri](help/database/db_item-uri) | id |
+| thr-parent-id | [item-uri](help/database/db_item-uri) | id |
+| external-id | [item-uri](help/database/db_item-uri) | id |
+| owner-id | [contact](help/database/db_contact) | id |
+| author-id | [contact](help/database/db_contact) | id |
+| causer-id | [contact](help/database/db_contact) | id |
+| vid | [verb](help/database/db_verb) | id |
+
 Return to [database documentation](help/database)
index 648019e835e942089ee612112a9a43802e53cebd..aca53c70a113da65dc57d14f6ebbe4b3c1d5ad04 100644 (file)
@@ -3,10 +3,22 @@ Table process
 
 Currently running system processes
 
+Fields
+------
+
 | Field   | Description | Type          | Null | Key | Default             | Extra |
 | ------- | ----------- | ------------- | ---- | --- | ------------------- | ----- |
 | pid     |             | int unsigned  | NO   | PRI | NULL                |       |
 | command |             | varbinary(32) | NO   |     |                     |       |
 | created |             | datetime      | NO   |     | 0001-01-01 00:00:00 |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | pid |
+| command | command |
+
+
 Return to [database documentation](help/database)
index be97c5d4a84f44610becf093531411f90d71a797..79de8ade5db37ad1eb3870ccba78f1beacc407ff 100644 (file)
@@ -3,6 +3,9 @@ Table profile
 
 user profiles data
 
+Fields
+------
+
 | Field        | Description                                   | Type               | Null | Key | Default    | Extra          |
 | ------------ | --------------------------------------------- | ------------------ | ---- | --- | ---------- | -------------- |
 | id           | sequential ID                                 | int unsigned       | NO   | PRI | NULL       | auto_increment |
@@ -48,4 +51,20 @@ user profiles data
 | publish      | publish default profile in local directory    | boolean            | NO   |     | 0          |                |
 | net-publish  | publish profile in global directory           | boolean            | NO   |     | 0          |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_is-default | uid, is-default |
+| pub_keywords | FULLTEXT, pub_keywords |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 77f4bb61889cb4e2fbb723dc4066da2692f90e41..1c7bc81476a3b501691f0463f8346dab0c2a7c1a 100644 (file)
@@ -3,6 +3,9 @@ Table profile_check
 
 DFRN remote auth use
 
+Fields
+------
+
 | Field   | Description   | Type               | Null | Key | Default | Extra          |
 | ------- | ------------- | ------------------ | ---- | --- | ------- | -------------- |
 | id      | sequential ID | int unsigned       | NO   | PRI | NULL    | auto_increment |
@@ -12,4 +15,21 @@ DFRN remote auth use
 | sec     |               | varchar(255)       | NO   |     |         |                |
 | expire  |               | int unsigned       | NO   |     | 0       |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid | uid |
+| cid | cid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+| cid | [contact](help/database/db_contact) | id |
+
 Return to [database documentation](help/database)
index 7bf2e9dcd9cff54a0f51b29977373cbc50b33a2e..e920bcd1a07c231ca59de1e906f8717b95bcbb19 100644 (file)
@@ -3,6 +3,9 @@ Table profile_field
 
 Custom profile fields
 
+Fields
+------
+
 | Field   | Description                                                 | Type               | Null | Key | Default             | Extra          |
 | ------- | ----------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id      | sequential ID                                               | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -14,4 +17,22 @@ Custom profile fields
 | created | creation time                                               | datetime           | NO   |     | 0001-01-01 00:00:00 |                |
 | edited  | last edit time                                              | datetime           | NO   |     | 0001-01-01 00:00:00 |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid | uid |
+| order | order |
+| psid | psid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+| psid | [permissionset](help/database/db_permissionset) | id |
+
 Return to [database documentation](help/database)
index fde15de14aec332f9d149ebce45872dd79dd71de..9c5094b6f5082ada5e1b2520a7e60ecd19fa228b 100644 (file)
@@ -3,6 +3,9 @@ Table push_subscriber
 
 Used for OStatus: Contains feed subscribers
 
+Fields
+------
+
 | Field        | Description                       | Type               | Null | Key | Default             | Extra          |
 | ------------ | --------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id           | sequential ID                     | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -16,4 +19,20 @@ Used for OStatus: Contains feed subscribers
 | renewed      | Date of last subscription renewal | datetime           | NO   |     | 0001-01-01 00:00:00 |                |
 | secret       |                                   | varchar(255)       | NO   |     |                     |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| next_try | next_try |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index fac22811d4b65e30e78c36b63fd3969d2cdb4e18..856128a42523ee3f7f08466d4b9032860e0284bd 100644 (file)
@@ -3,6 +3,9 @@ Table register
 
 registrations requiring admin approval
 
+Fields
+------
+
 | Field    | Description   | Type               | Null | Key | Default             | Extra          |
 | -------- | ------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | id       | sequential ID | int unsigned       | NO   | PRI | NULL                | auto_increment |
@@ -13,4 +16,19 @@ registrations requiring admin approval
 | language |               | varchar(16)        | NO   |     |                     |                |
 | note     |               | text               | YES  |     | NULL                |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index dc20ac42a5d0c3190c5ef7a7564db42ac47d71f6..2b7684b0b87304dfb782301dfa1eda1439f3ce98 100644 (file)
@@ -3,10 +3,29 @@ Table search
 
 
 
+Fields
+------
+
 | Field | Description   | Type               | Null | Key | Default | Extra          |
 | ----- | ------------- | ------------------ | ---- | --- | ------- | -------------- |
 | id    | sequential ID | int unsigned       | NO   | PRI | NULL    | auto_increment |
 | uid   | User id       | mediumint unsigned | NO   |     | 0       |                |
 | term  |               | varchar(255)       | NO   |     |         |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| uid_term | uid, term(64) |
+| term | term(64) |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index d01b5736471a01334d7a4ab45630de1ce27cb63f..72810e7e93fc0524dc347fa7b32607ba3f12b102 100644 (file)
@@ -3,6 +3,9 @@ Table session
 
 web session storage
 
+Fields
+------
+
 | Field  | Description   | Type            | Null | Key | Default | Extra          |
 | ------ | ------------- | --------------- | ---- | --- | ------- | -------------- |
 | id     | sequential ID | bigint unsigned | NO   | PRI | NULL    | auto_increment |
@@ -10,4 +13,14 @@ web session storage
 | data   |               | text            | YES  |     | NULL    |                |
 | expire |               | int unsigned    | NO   |     | 0       |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| sid | sid(64) |
+| expire | expire |
+
+
 Return to [database documentation](help/database)
index 21596ba65300f39214f6327855e5f5bb509f5de4..4278fbfd3da4eb670298c123163423a7f88fa943 100644 (file)
@@ -3,9 +3,20 @@ Table storage
 
 Data stored by Database storage backend
 
+Fields
+------
+
 | Field | Description                    | Type         | Null | Key | Default | Extra          |
 | ----- | ------------------------------ | ------------ | ---- | --- | ------- | -------------- |
 | id    | Auto incremented image data id | int unsigned | NO   | PRI | NULL    | auto_increment |
 | data  | file data                      | longblob     | NO   |     | NULL    |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+
+
 Return to [database documentation](help/database)
index f52478c855a031173a309188ac6fca59d433081c..071eb7928d02a856e884c33380fc59470d7dfb7c 100644 (file)
@@ -3,10 +3,23 @@ Table tag
 
 tags and mentions
 
+Fields
+------
+
 | Field | Description | Type           | Null | Key | Default | Extra          |
 | ----- | ----------- | -------------- | ---- | --- | ------- | -------------- |
 | id    |             | int unsigned   | NO   | PRI | NULL    | auto_increment |
 | name  |             | varchar(96)    | NO   |     |         |                |
 | url   |             | varbinary(255) | NO   |     |         |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| type_name_url | UNIQUE, name, url |
+| url | url |
+
+
 Return to [database documentation](help/database)
index bf20f16b824eb61e75d8f4cef92e2a9db39059e9..11691005499e13f6ba34de6c555e0cf7bf946e00 100644 (file)
@@ -3,6 +3,9 @@ Table tokens
 
 OAuth usage
 
+Fields
+------
+
 | Field     | Description | Type               | Null | Key | Default | Extra |
 | --------- | ----------- | ------------------ | ---- | --- | ------- | ----- |
 | id        |             | varchar(40)        | NO   | PRI | NULL    |       |
@@ -12,4 +15,21 @@ OAuth usage
 | scope     |             | varchar(200)       | NO   |     |         |       |
 | uid       | User id     | mediumint unsigned | NO   |     | 0       |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| client_id | client_id |
+| uid | uid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| client_id | [clients](help/database/db_clients) | client_id |
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 9bcbff7d337430a978a6fc3d61c95c23a2e6ca30..8c8f12f75b3afb70bee24358c5e2529fbce17047 100644 (file)
@@ -3,6 +3,9 @@ Table user-contact
 
 User specific public contact data
 
+Fields
+------
+
 | Field     | Description                                 | Type               | Null | Key | Default | Extra |
 | --------- | ------------------------------------------- | ------------------ | ---- | --- | ------- | ----- |
 | cid       | Contact id of the linked public contact     | int unsigned       | NO   | PRI | 0       |       |
@@ -11,4 +14,20 @@ User specific public contact data
 | ignored   | Posts from this contact are ignored         | boolean            | YES  |     | NULL    |       |
 | collapsed | Posts from this contact are collapsed       | boolean            | YES  |     | NULL    |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uid, cid |
+| cid | cid |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| cid | [contact](help/database/db_contact) | id |
+| uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index 8cc762cc225f089e86df33142c37d11ba08d0339..8104e0f0f33de65912094d4584e6d3262ee33a58 100644 (file)
@@ -3,6 +3,9 @@ Table user
 
 The local users
 
+Fields
+------
+
 | Field                    | Description                                               | Type               | Null | Key | Default             | Extra          |
 | ------------------------ | --------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
 | uid                      | sequential ID                                             | mediumint unsigned | NO   | PRI | NULL                | auto_increment |
@@ -51,4 +54,22 @@ The local users
 | deny_gid                 | default permission for this user                          | mediumtext         | YES  |     | NULL                |                |
 | openidserver             |                                                           | text               | YES  |     | NULL                |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | uid |
+| nickname | nickname(32) |
+| parent-uid | parent-uid |
+| guid | guid |
+| email | email(64) |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| parent-uid | [user](help/database/db_user) | uid |
+
 Return to [database documentation](help/database)
index eaef348749214082ba3d88643d583508e901d8eb..cca71a2722dc35d0e924d050837f0cc024bba1b0 100644 (file)
@@ -3,9 +3,21 @@ Table userd
 
 Deleted usernames
 
+Fields
+------
+
 | Field    | Description   | Type         | Null | Key | Default | Extra          |
 | -------- | ------------- | ------------ | ---- | --- | ------- | -------------- |
 | id       | sequential ID | int unsigned | NO   | PRI | NULL    | auto_increment |
 | username |               | varchar(255) | NO   |     | NULL    |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| username | username(32) |
+
+
 Return to [database documentation](help/database)
index cd5d66f83593d59b395060c5f29e224e33664229..6613225f937a4728d897fcf2d5e97a0fe5600115 100644 (file)
@@ -3,9 +3,21 @@ Table verb
 
 Activity Verbs
 
+Fields
+------
+
 | Field | Description | Type              | Null | Key | Default | Extra          |
 | ----- | ----------- | ----------------- | ---- | --- | ------- | -------------- |
 | id    |             | smallint unsigned | NO   | PRI | NULL    | auto_increment |
 | name  |             | varchar(100)      | NO   |     |         |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| name | name |
+
+
 Return to [database documentation](help/database)
index 57ec489352e93030648b38eb406eb50fe404ac1c..ac34d4649f9dc29f42491fa6ddffa4a75e721dc7 100644 (file)
@@ -3,9 +3,20 @@ Table worker-ipc
 
 Inter process communication between the frontend and the worker
 
+Fields
+------
+
 | Field | Description               | Type    | Null | Key | Default | Extra |
 | ----- | ------------------------- | ------- | ---- | --- | ------- | ----- |
 | key   |                           | int     | NO   | PRI | NULL    |       |
 | jobs  | Flag for outstanding jobs | boolean | YES  |     | NULL    |       |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | key |
+
+
 Return to [database documentation](help/database)
index 16b6a2e0d89c056aa5b1e7de41278abcf838e66b..7510b7a7629e3d56bccfe2192e9542bce661fcf0 100644 (file)
@@ -3,6 +3,9 @@ Table workerqueue
 
 Background tasks queue entries
 
+Fields
+------
+
 | Field     | Description                                             | Type             | Null | Key | Default             | Extra          |
 | --------- | ------------------------------------------------------- | ---------------- | ---- | --- | ------------------- | -------------- |
 | id        | Auto incremented worker task id                         | int unsigned     | NO   | PRI | NULL                | auto_increment |
@@ -16,4 +19,20 @@ Background tasks queue entries
 | retrial   | Retrial counter                                         | tinyint          | NO   |     | 0                   |                |
 | done      | Marked 1 when the task was done - will be deleted later | boolean          | NO   |     | 0                   |                |
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+| PRIMARY | id |
+| command | command |
+| done_command_parameter | done, command, parameter(64) |
+| done_executed | done, executed |
+| done_priority_retrial_created | done, priority, retrial, created |
+| done_priority_next_try | done, priority, next_try |
+| done_pid_next_try | done, pid, next_try |
+| done_pid_retrial | done, pid, retrial |
+| done_pid_priority_created | done, pid, priority, created |
+
+
 Return to [database documentation](help/database)
index 4451b09ab6be8cbadcf2e4d2f5df98cf17a77f18..864f2ded3f19cedbe1f62e9b7ee459830b07121f 100644 (file)
@@ -166,6 +166,12 @@ class DBStructure
 
                $tables = [];
                foreach (self::definition(null) as $name => $definition) {
+                       $indexes = [];
+                       foreach ($definition['indexes'] as $key => $value) {
+                               $indexes[] = ['name' => $key, 'fields' => implode(', ', $value)];
+                       }
+
+                       $foreign = [];
                        $fields  = [[
                                'name'    => 'Field',
                                'comment' => 'Description',
@@ -174,7 +180,7 @@ class DBStructure
                                'primary' => 'Key',
                                'default' => 'Default',
                                'extra'   => 'Extra',
-                       ], 
+                       ],
                        [
                                'name'    => '-',
                                'comment' => '-',
@@ -202,33 +208,43 @@ class DBStructure
                                $field['primary'] = ($value['primary'] ?? false) ? 'PRI' : '';
                                $field['default'] = $value['default'] ?? 'NULL';
                                $field['extra']   = $value['extra'] ?? '';
-               
+
                                foreach ($field as $fieldname => $fieldvalue) {
                                        $lengths[$fieldname] = max($lengths[$fieldname] ?? 0, strlen($fieldvalue));
                                }
                                $fields[] = $field;
+
+                               if (!empty($value['foreign'])) {
+                                       $foreign[] = [
+                                               'field'       => $key,
+                                               'targettable' => array_keys($value['foreign'])[0],
+                                               'targetfield' => array_values($value['foreign'])[0]
+                                       ];
+                               }
                        }
 
                        array_walk_recursive($fields, function(&$value, $key) use ($lengths)
                        {
                                $value = str_pad($value, $lengths[$key], $value === '-' ? '-' : ' ');
                        });
-                       
+
                        $tables[] = ['name' => $name, 'comment' => $definition['comment']];
                        $content = Renderer::replaceMacros(Renderer::getMarkupTemplate('structure.tpl'), [
                                '$name'    => $name,
                                '$comment' => $definition['comment'],
                                '$fields'  => $fields,
+                               '$indexes' => $indexes,
+                               '$foreign' => $foreign,
                        ]);
                        $filename = DI::basePath() . '/doc/database/db_' . $name . '.md';
                        file_put_contents($filename, $content);
                }
                asort($tables);
                $content = Renderer::replaceMacros(Renderer::getMarkupTemplate('tables.tpl'), [
-                       '$tables'  => $tables,  
+                       '$tables'  => $tables,
                ]);
                $filename = DI::basePath() . '/doc/database.md';
-               file_put_contents($filename, $content);         
+               file_put_contents($filename, $content);
        }
 
        public static function printStructure($basePath)
@@ -1278,7 +1294,7 @@ class DBStructure
                                if ($verbose) {
                                        echo "Zero contact added\n";
                                }
-                       }               
+                       }
                } elseif (self::existsTable('contact') && $verbose) {
                        echo "Zero contact already added\n";
                } elseif ($verbose) {
@@ -1302,7 +1318,7 @@ class DBStructure
 
                if (self::existsTable('permissionset')) {
                        if (!DBA::exists('permissionset', ['id' => 0])) {
-                               DBA::insert('permissionset', ['allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '']);       
+                               DBA::insert('permissionset', ['allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '']);
                                $lastid = DBA::lastInsertId();
                                if ($lastid != 0) {
                                        DBA::update('permissionset', ['id' => 0], ['id' => $lastid]);
@@ -1337,7 +1353,7 @@ class DBStructure
                } elseif ($verbose) {
                        echo "permissionset: Table not found\n";
                }
-       
+
                if (!self::existsForeignKeyForField('tokens', 'client_id')) {
                        $tokens = DBA::p("SELECT `tokens`.`id` FROM `tokens`
                                LEFT JOIN `clients` ON `clients`.`client_id` = `tokens`.`client_id`
index 3ec9ba9b2d5d03dd98e41c5e06be274e38343be3..14704973a0b7d96497494fc5c4ba55417f0bb031 100644 (file)
@@ -3,8 +3,31 @@ Table {{$name}}
 
 {{$comment}}
 
+Fields
+------
+
 {{foreach $fields as $field}}
 | {{$field.name}} | {{$field.comment}} | {{$field.type}} | {{$field.null}} | {{$field.primary}} | {{$field.default}} | {{$field.extra}} |
 {{/foreach}}
 
+Indexes
+------------
+
+| Name | Fields |
+|------|---------|
+{{foreach $indexes as $index}}
+| {{$index.name}} | {{$index.fields}} |
+{{/foreach}}
+
+{{if $foreign}}
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+{{foreach $foreign as $key}}
+| {{$key.field}} | [{{$key.targettable}}](help/database/db_{{$key.targettable}}) | {{$key.targetfield}} |
+{{/foreach}}
+{{/if}}
+
 Return to [database documentation](help/database)