Indexes and foreign keys added

This commit is contained in:
Michael 2021-06-14 08:53:37 +00:00
parent 2cd0c1d30d
commit 96f07c7288
73 changed files with 1366 additions and 8 deletions

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View file

@ -3,6 +3,9 @@ Table parsed_url
cache for 'parse_url' 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 'parse_url' 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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`

View 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)