* Use "LEFT JOIN" to always fetch the item. Needed for update routines.
* New conversion routine that now covers every item
* Post update is now activated
* We now use a hash based upon RIPEMD-320 for content and activity
* The hash doesn't contain the plink anymore
* Legacy item fields are now "null"able
* New hash function for a server unique item hash
* Introduction of the legacy mode (usage of old item fields)
* Code simplification
* We don't need the "uri" fields anymore in item-activity and item-content
* Use the "created" and not the "received" date for the hash
* Avoiding several notices
* Some more warnings removed
* Improved uri-hash / Likes on Diaspora are now getting a creation date
* Corrected the post update version
* Ensure an unique uri-hash
* Don't delete orhaned item data at the moment
* Partly reworked, due to strange behaviour
* Some more parts reworked
* Using the uri currently seems to be more reliable
* Using the uri here as well
* Use the hash values again
* Grouped item fields in different categories
* Notices again
* use the gravity (we always should)
* Added hint for disabled post updates
* Notices ...
* Issue #5337: Personal notes are displayed again
* Use the gravity again
pull/5384/head
Michael Vogel5 years agocommitted byHypolite Petovan
`wall`booleanNOTNULLDEFAULT'0'COMMENT'This item was posted to the wall of uid',
`gravity`tinyintunsignedNOTNULLDEFAULT0COMMENT'',
`uri-hash`varchar(80)NOTNULLDEFAULT''COMMENT'RIPEMD-128 hash from uri',
`parent`intunsignedNOTNULLDEFAULT0COMMENT'item.id of the parent to this item if it is a reply of some form; otherwise this must be set to the id of this item',
`parent-uri`varchar(255)NOTNULLDEFAULT''COMMENT'uri of the parent to this item',
`extid`varchar(255)NOTNULLDEFAULT''COMMENT'',
`thr-parent`varchar(255)NOTNULLDEFAULT''COMMENT'If the parent of this item is not the top-level item in the conversation, the uri of the immediate parent; otherwise set to parent-uri',
`changed`datetimeNOTNULLDEFAULT'0001-01-01 00:00:00'COMMENT'Date that something in the conversation changed, indicating clients should fetch the conversation again',
`gravity`tinyintunsignedNOTNULLDEFAULT0COMMENT'',
`network`char(4)NOTNULLDEFAULT''COMMENT'Network from where the item comes from',
`owner-id`intunsignedNOTNULLDEFAULT0COMMENT'Link to the contact table with uid=0 of the owner of this item',
`owner-name`varchar(255)NOTNULLDEFAULT''COMMENT'Name of the owner of this item',
`owner-link`varchar(255)NOTNULLDEFAULT''COMMENT'Link to the profile page of the owner of this item',
`owner-avatar`varchar(255)NOTNULLDEFAULT''COMMENT'Link to the avatar picture of the owner of this item',
`author-id`intunsignedNOTNULLDEFAULT0COMMENT'Link to the contact table with uid=0 of the author of this item',
`author-name`varchar(255)NOTNULLDEFAULT''COMMENT'Name of the author of this item',
`author-link`varchar(255)NOTNULLDEFAULT''COMMENT'Link to the profile page of the author of this item',
`author-avatar`varchar(255)NOTNULLDEFAULT''COMMENT'Link to the avatar picture of the author of this item',
`icid`intunsignedCOMMENT'Id of the item-content table entry that contains the whole item content',
`iaid`intunsignedCOMMENT'Id of the item-activity table entry that contains the activity data',
`object`textCOMMENT'JSON encoded object structure unless it is an implied object (normal post)',
`target-type`varchar(100)NOTNULLDEFAULT''COMMENT'ActivityStreams target type if applicable (URI)',
`target`textCOMMENT'JSON encoded target structure if used',
`postopts`textCOMMENT'External post connectors add their network name to this comma-separated string to identify that they should be delivered to these networks during delivery',
`plink`varchar(255)NOTNULLDEFAULT''COMMENT'permalink or URL to a displayable copy of the message at its source',
`resource-id`varchar(32)NOTNULLDEFAULT''COMMENT'Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type',
`event-id`intunsignedNOTNULLDEFAULT0COMMENT'Used to link to the event.id',
`tag`mediumtextCOMMENT'',
`attach`mediumtextCOMMENT'JSON structure representing attachments to this item',
`inform`mediumtextCOMMENT'',
`file`mediumtextCOMMENT'',
`location`varchar(255)NOTNULLDEFAULT''COMMENT'text location where this item originated',
`coord`varchar(255)NOTNULLDEFAULT''COMMENT'longitude/latitude pair representing location where this item originated',
`allow_cid`mediumtextCOMMENT'Access Control - list of allowed contact.id \'<19><78>\'',
`allow_gid`mediumtextCOMMENT'Access Control - list of allowed groups',
`deny_cid`mediumtextCOMMENT'Access Control - list of denied contact.id',
`deny_gid`mediumtextCOMMENT'Access Control - list of denied groups',
`extid`varchar(255)NOTNULLDEFAULT''COMMENT'',
`global`booleanNOTNULLDEFAULT'0'COMMENT'',
`private`booleanNOTNULLDEFAULT'0'COMMENT'distribution is restricted',
`pubmail`booleanNOTNULLDEFAULT'0'COMMENT'',
`moderated`booleanNOTNULLDEFAULT'0'COMMENT'',
`visible`booleanNOTNULLDEFAULT'0'COMMENT'',
`starred`booleanNOTNULLDEFAULT'0'COMMENT'item has been favourited',
`bookmark`booleanNOTNULLDEFAULT'0'COMMENT'item has been bookmarked',
`unseen`booleanNOTNULLDEFAULT'1'COMMENT'item has not been seen',
`visible`booleanNOTNULLDEFAULT'0'COMMENT'',
`moderated`booleanNOTNULLDEFAULT'0'COMMENT'',
`deleted`booleanNOTNULLDEFAULT'0'COMMENT'item has been deleted',
`uid`mediumintunsignedNOTNULLDEFAULT0COMMENT'Owner id which owns this copy of the item',
`allow_cid`mediumtextCOMMENT'Access Control - list of allowed contact.id \'<19><78>\'',
`allow_gid`mediumtextCOMMENT'Access Control - list of allowed groups',
`deny_cid`mediumtextCOMMENT'Access Control - list of denied contact.id',
`deny_gid`mediumtextCOMMENT'Access Control - list of denied groups',
`postopts`textCOMMENT'External post connectors add their network name to this comma-separated string to identify that they should be delivered to these networks during delivery',
`inform`mediumtextCOMMENT'Additional receivers of this post',
`resource-id`varchar(32)NOTNULLDEFAULT''COMMENT'Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type',
`event-id`intunsignedNOTNULLDEFAULT0COMMENT'Used to link to the event.id',
`attach`mediumtextCOMMENT'JSON structure representing attachments to this item',
`type`varchar(20)NOTNULLDEFAULT''COMMENT'',
`file`mediumtextCOMMENT'Deprecated',
`location`varchar(255)COMMENT'Deprecated',
`coord`varchar(255)COMMENT'Deprecated',
`tag`mediumtextCOMMENT'Deprecated',
`plink`varchar(255)COMMENT'Deprecated',
`title`varchar(255)COMMENT'Deprecated',
`content-warning`varchar(255)COMMENT'Deprecated',
`body`mediumtextCOMMENT'Deprecated',
`app`varchar(255)COMMENT'Deprecated',
`verb`varchar(100)COMMENT'Deprecated',
`object-type`varchar(100)COMMENT'Deprecated',
`object`textCOMMENT'Deprecated',
`target-type`varchar(100)COMMENT'Deprecated',
`target`textCOMMENT'Deprecated',
`author-name`varchar(255)COMMENT'Deprecated',
`author-link`varchar(255)COMMENT'Deprecated',
`author-avatar`varchar(255)COMMENT'Deprecated',
`owner-name`varchar(255)COMMENT'Deprecated',
`owner-link`varchar(255)COMMENT'Deprecated',
`owner-avatar`varchar(255)COMMENT'Deprecated',
`rendered-hash`varchar(32)COMMENT'Deprecated',
`rendered-html`mediumtextCOMMENT'Deprecated',
PRIMARYKEY(`id`),
INDEX`guid`(`guid`(191)),
INDEX`uri`(`uri`(191)),
@ -549,8 +550,8 @@ CREATE TABLE IF NOT EXISTS `item` (
--
CREATETABLEIFNOTEXISTS`item-activity`(
`id`intunsignedNOTNULLauto_increment,
`uri`varchar(255)NOTNULLDEFAULT''COMMENT'',
`uri-hash`char(80)NOTNULLDEFAULT''COMMENT'SHA-1 and RIPEMD-160 hash from uri',
`uri`varchar(255)COMMENT'',
`uri-hash`varchar(80)NOTNULLDEFAULT''COMMENT'RIPEMD-128 hash from uri',
"parent" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => "item.id of the parent to this item if it is a reply of some form; otherwise this must be set to the id of this item"],
"parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "uri of the parent to this item"],
"thr-parent" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "If the parent of this item is not the top-level item in the conversation, the uri of the immediate parent; otherwise set to parent-uri"],
"network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network from where the item comes from"],
"owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Link to the contact table with uid=0 of the owner of this item"],
"owner-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name of the owner of this item"],
"owner-link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the profile page of the owner of this item"],
"owner-avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the avatar picture of the owner of this item"],
"author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Link to the contact table with uid=0 of the author of this item"],
"author-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name of the author of this item"],
"author-link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the profile page of the author of this item"],
"author-avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the avatar picture of the author of this item"],
"icid" => ["type" => "int unsigned", "relation" => ["item-content" => "id"], "comment" => "Id of the item-content table entry that contains the whole item content"],
"iaid" => ["type" => "int unsigned", "relation" => ["item-activity" => "id"], "comment" => "Id of the item-activity table entry that contains the activity data"],
"postopts" => ["type" => "text", "comment" => "External post connectors add their network name to this comma-separated string to identify that they should be delivered to these networks during delivery"],
"plink" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "permalink or URL to a displayable copy of the message at its source"],
"resource-id" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type"],
"event-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["event" => "id"], "comment" => "Used to link to the event.id"],
// User specific fields. Should possible be replaced with something different
"allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
"allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
"deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
"deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
"postopts" => ["type" => "text", "comment" => "External post connectors add their network name to this comma-separated string to identify that they should be delivered to these networks during delivery"],
"inform" => ["type" => "mediumtext", "comment" => "Additional receivers of this post"],
// It is to be decided whether these fields belong to the user or the structure
"resource-id" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type"],
"event-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["event" => "id"], "comment" => "Used to link to the event.id"],
// Will be replaced by the "attach" table
"attach" => ["type" => "mediumtext", "comment" => "JSON structure representing attachments to this item"],
// Seems to be only used for notes, but is filled at many places.
// Will be replaced with some general field that contain the values of "origin" and "wall" as well.