]> git.mxchange.org Git - friendica.git/commitdiff
database.sql updated, standards fixed
authorMichael <heluecht@pirati.ca>
Thu, 21 Jul 2022 05:42:53 +0000 (05:42 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 21 Jul 2022 05:42:53 +0000 (05:42 +0000)
database.sql
doc/database.md
doc/database/db_inbox-entry-receiver.md [new file with mode: 0644]
doc/database/db_inbox-entry.md [new file with mode: 0644]
src/Protocol/ActivityPub/Queue.php

index 01bd84b00b28ed58bc76f467e1478fbc3fba5d58..d8b26cebeb65293a9ee8a3ebbec324ab31b4cfb4 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2022.09-dev (Giant Rhubarb)
--- DB_UPDATE_VERSION 1473
+-- DB_UPDATE_VERSION 1474
 -- ------------------------------------------
 
 
@@ -724,6 +724,39 @@ CREATE TABLE IF NOT EXISTS `hook` (
         UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
 
+--
+-- TABLE inbox-entry
+--
+CREATE TABLE IF NOT EXISTS `inbox-entry` (
+       `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
+       `activity-id` varbinary(255) COMMENT 'id of the incoming activity',
+       `object-id` varbinary(255) COMMENT '',
+       `in-reply-to-id` varbinary(255) COMMENT '',
+       `type` varchar(64) COMMENT 'Type of the activity',
+       `object-type` varchar(64) COMMENT 'Type of the object activity',
+       `object-object-type` varchar(64) COMMENT 'Type of the object\'s object activity',
+       `received` datetime COMMENT 'Receiving date',
+       `activity` mediumtext COMMENT 'The JSON activity',
+       `signer` varchar(255) COMMENT '',
+       `push` boolean NOT NULL DEFAULT '0' COMMENT '',
+        PRIMARY KEY(`id`),
+        UNIQUE INDEX `activity-id` (`activity-id`),
+        INDEX `object-id` (`object-id`),
+        INDEX `received` (`received`)
+) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Incoming activity';
+
+--
+-- TABLE inbox-entry-receiver
+--
+CREATE TABLE IF NOT EXISTS `inbox-entry-receiver` (
+       `queue-id` int unsigned NOT NULL COMMENT '',
+       `uid` mediumint unsigned NOT NULL COMMENT 'User id',
+        PRIMARY KEY(`queue-id`,`uid`),
+        INDEX `uid` (`uid`),
+       FOREIGN KEY (`queue-id`) REFERENCES `inbox-entry` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
+       FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
+) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Receiver for the incoming activity';
+
 --
 -- TABLE inbox-status
 --
index fcff590e1381b0f92f9adcb123c1534ce8bed28f..0effb1754adbec7cf305051fd22927176f01f87e 100644 (file)
@@ -31,6 +31,8 @@ Database Tables
 | [gserver](help/database/db_gserver) | Global servers |
 | [gserver-tag](help/database/db_gserver-tag) | Tags that the server has subscribed |
 | [hook](help/database/db_hook) | addon hook registry |
+| [inbox-entry](help/database/db_inbox-entry) | Incoming activity |
+| [inbox-entry-receiver](help/database/db_inbox-entry-receiver) | Receiver for the incoming activity |
 | [inbox-status](help/database/db_inbox-status) | Status of ActivityPub inboxes |
 | [intro](help/database/db_intro) |  |
 | [item-uri](help/database/db_item-uri) | URI and GUID for items |
diff --git a/doc/database/db_inbox-entry-receiver.md b/doc/database/db_inbox-entry-receiver.md
new file mode 100644 (file)
index 0000000..f905289
--- /dev/null
@@ -0,0 +1,30 @@
+Table inbox-entry-receiver
+===========
+
+Receiver for the incoming activity
+
+Fields
+------
+
+| Field    | Description | Type               | Null | Key | Default | Extra |
+| -------- | ----------- | ------------------ | ---- | --- | ------- | ----- |
+| queue-id |             | int unsigned       | NO   | PRI | NULL    |       |
+| uid      | User id     | mediumint unsigned | NO   | PRI | NULL    |       |
+
+Indexes
+------------
+
+| Name    | Fields        |
+| ------- | ------------- |
+| PRIMARY | queue-id, uid |
+| uid     | uid           |
+
+Foreign Keys
+------------
+
+| Field | Target Table | Target Field |
+|-------|--------------|--------------|
+| queue-id | [inbox-entry](help/database/db_inbox-entry) | id |
+| uid | [user](help/database/db_user) | uid |
+
+Return to [database documentation](help/database)
diff --git a/doc/database/db_inbox-entry.md b/doc/database/db_inbox-entry.md
new file mode 100644 (file)
index 0000000..56dee2c
--- /dev/null
@@ -0,0 +1,34 @@
+Table inbox-entry
+===========
+
+Incoming activity
+
+Fields
+------
+
+| Field              | Description                          | Type           | Null | Key | Default | Extra          |
+| ------------------ | ------------------------------------ | -------------- | ---- | --- | ------- | -------------- |
+| id                 | sequential ID                        | int unsigned   | NO   | PRI | NULL    | auto_increment |
+| activity-id        | id of the incoming activity          | varbinary(255) | YES  |     | NULL    |                |
+| object-id          |                                      | varbinary(255) | YES  |     | NULL    |                |
+| in-reply-to-id     |                                      | varbinary(255) | YES  |     | NULL    |                |
+| type               | Type of the activity                 | varchar(64)    | YES  |     | NULL    |                |
+| object-type        | Type of the object activity          | varchar(64)    | YES  |     | NULL    |                |
+| object-object-type | Type of the object's object activity | varchar(64)    | YES  |     | NULL    |                |
+| received           | Receiving date                       | datetime       | YES  |     | NULL    |                |
+| activity           | The JSON activity                    | mediumtext     | YES  |     | NULL    |                |
+| signer             |                                      | varchar(255)   | YES  |     | NULL    |                |
+| push               |                                      | boolean        | NO   |     | 0       |                |
+
+Indexes
+------------
+
+| Name        | Fields              |
+| ----------- | ------------------- |
+| PRIMARY     | id                  |
+| activity-id | UNIQUE, activity-id |
+| object-id   | object-id           |
+| received    | received            |
+
+
+Return to [database documentation](help/database)
index 12bf7e268df33a21fe81c0998556d22f31b009df..c3605ebb64d3b425e2341573620450fefeb8dd19 100644 (file)
@@ -44,7 +44,7 @@ class Queue
        public static function add(array $activity, string $type, int $uid, string $http_signer, bool $push): array
        {
                $fields = [
-                       'activity-id' => $activity['id'],
+                       'activity-id' => $activity['id'],
                        'object-id'   => $activity['object_id'],
                        'type'        => $type,
                        'object-type' => $activity['object_type'],
@@ -104,9 +104,9 @@ class Queue
 
                Logger::debug('Processing queue entry', ['id' => $entry['id'], 'type' => $entry['type'], 'object-type' => $entry['object-type'], 'uri' => $entry['object-id'], 'in-reply-to' => $entry['in-reply-to-id']]);
 
-               $activity   = json_decode($entry['activity'], true);
-               $type       = $entry['type'];
-               $push       = $entry['push'];
+               $activity = json_decode($entry['activity'], true);
+               $type     = $entry['type'];
+               $push     = $entry['push'];
 
                $activity['entry-id'] = $entry['id'];