mirror of
https://github.com/friendica/friendica
synced 2025-04-29 09:44:23 +02:00
We now store the item delivery data in a separate table (#5413)
* We now store the item delivery data in a separate table * Reorganized table structure
This commit is contained in:
parent
ece4d3f4fb
commit
ec49d004e3
5 changed files with 109 additions and 19 deletions
|
@ -1196,15 +1196,14 @@ class DBStructure
|
|||
"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"],
|
||||
// These fields will be moved into some item-delivery-information table
|
||||
"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"],
|
||||
// Could possibly be replaced by the "attach" table?
|
||||
"attach" => ["type" => "mediumtext", "comment" => "JSON structure representing attachments to this item"],
|
||||
// Deprecated fields. Will be removed in upcoming versions
|
||||
"postopts" => ["type" => "text", "comment" => "Deprecated"],
|
||||
"inform" => ["type" => "mediumtext", "comment" => "Deprecated"],
|
||||
"type" => ["type" => "varchar(20)", "comment" => "Deprecated"],
|
||||
"bookmark" => ["type" => "boolean", "comment" => "Deprecated"],
|
||||
"file" => ["type" => "mediumtext", "comment" => "Deprecated"],
|
||||
|
@ -1301,6 +1300,17 @@ class DBStructure
|
|||
"uri" => ["uri(191)"],
|
||||
]
|
||||
];
|
||||
$database["item-delivery-data"] = [
|
||||
"comment" => "Delivery data for items",
|
||||
"fields" => [
|
||||
"iid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "relation" => ["item" => "id"], "comment" => "Item id"],
|
||||
"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 the linked item"],
|
||||
],
|
||||
"indexes" => [
|
||||
"PRIMARY" => ["iid"],
|
||||
]
|
||||
];
|
||||
$database["locks"] = [
|
||||
"comment" => "",
|
||||
"fields" => [
|
||||
|
|
|
@ -32,7 +32,7 @@ class PostUpdate
|
|||
if (!self::update1206()) {
|
||||
return;
|
||||
}
|
||||
if (!self::update1278()) {
|
||||
if (!self::update1279()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -228,20 +228,21 @@ class PostUpdate
|
|||
*
|
||||
* @return bool "true" when the job is done
|
||||
*/
|
||||
private static function update1278()
|
||||
private static function update1279()
|
||||
{
|
||||
// Was the script completed?
|
||||
if (Config::get("system", "post_update_version") >= 1278) {
|
||||
if (Config::get("system", "post_update_version") >= 1279) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = Config::get("system", "post_update_version_1278_id", 0);
|
||||
$id = Config::get("system", "post_update_version_1279_id", 0);
|
||||
|
||||
logger("Start from item " . $id, LOGGER_DEBUG);
|
||||
|
||||
$fields = array_merge(Item::MIXED_CONTENT_FIELDLIST, ['network', 'author-id', 'owner-id', 'tag', 'file',
|
||||
'author-name', 'author-avatar', 'author-link', 'owner-name', 'owner-avatar', 'owner-link', 'id',
|
||||
'uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'psid', 'post-type', 'bookmark', 'type']);
|
||||
'uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'psid', 'post-type', 'bookmark', 'type',
|
||||
'inform']);
|
||||
|
||||
$start_id = $id;
|
||||
$rows = 0;
|
||||
|
@ -285,12 +286,12 @@ class PostUpdate
|
|||
}
|
||||
dba::close($items);
|
||||
|
||||
Config::set("system", "post_update_version_1278_id", $id);
|
||||
Config::set("system", "post_update_version_1279_id", $id);
|
||||
|
||||
logger("Processed rows: " . $rows . " - last processed item: " . $id, LOGGER_DEBUG);
|
||||
|
||||
if ($start_id == $id) {
|
||||
Config::set("system", "post_update_version", 1278);
|
||||
Config::set("system", "post_update_version", 1279);
|
||||
logger("Done", LOGGER_DEBUG);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue