]> git.mxchange.org Git - friendica.git/commitdiff
Add key-value table
authorPhilipp <admin@philipp.info>
Thu, 29 Dec 2022 15:54:08 +0000 (16:54 +0100)
committerPhilipp <admin@philipp.info>
Thu, 29 Dec 2022 20:38:47 +0000 (21:38 +0100)
database.sql
doc/database.md
doc/database/db_key-value.md [new file with mode: 0644]
static/dbstructure.config.php

index 7eb756cf2a3df73aa5140d9cba7c98e18251c7b8..4384d44f86074e3887ceeec197e6e10f132e3d08 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2023.03-dev (Giant Rhubarb)
--- DB_UPDATE_VERSION 1504
+-- DB_UPDATE_VERSION 1505
 -- ------------------------------------------
 
 
@@ -839,6 +839,17 @@ CREATE TABLE IF NOT EXISTS `intro` (
        FOREIGN KEY (`suggest-cid`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
 
+--
+-- TABLE key-value
+--
+CREATE TABLE IF NOT EXISTS `key-value` (
+       `id` int unsigned NOT NULL auto_increment COMMENT '',
+       `k` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
+       `v` mediumtext COMMENT '',
+        PRIMARY KEY(`id`),
+        UNIQUE INDEX `k` (`k`)
+) DEFAULT COLLATE utf8mb4_general_ci COMMENT='A key value storage';
+
 --
 -- TABLE locks
 --
index 9fa438c8d2a6daa14a19b121d95dbe27b79e5055..5759d29ec74e21f0982a25b85b0f0d41d9e67477 100644 (file)
@@ -40,6 +40,7 @@ Database Tables
 | [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 |
+| [key-value](help/database/db_key-value) | A key value storage |
 | [locks](help/database/db_locks) |  |
 | [mail](help/database/db_mail) | private messages |
 | [mailacct](help/database/db_mailacct) | Mail account data for fetching mails |
diff --git a/doc/database/db_key-value.md b/doc/database/db_key-value.md
new file mode 100644 (file)
index 0000000..a346e68
--- /dev/null
@@ -0,0 +1,24 @@
+Table key-value
+===========
+
+A key value storage
+
+Fields
+------
+
+| Field | Description | Type          | Null | Key | Default | Extra          |
+| ----- | ----------- | ------------- | ---- | --- | ------- | -------------- |
+| id    |             | int unsigned  | NO   | PRI | NULL    | auto_increment |
+| k     |             | varbinary(50) | NO   |     |         |                |
+| v     |             | mediumtext    | YES  |     | NULL    |                |
+
+Indexes
+------------
+
+| Name    | Fields    |
+| ------- | --------- |
+| PRIMARY | id        |
+| k       | UNIQUE, k |
+
+
+Return to [database documentation](help/database)
index 1d573fa87ec8f896b4c270e457efeef3c1da0a64..0128b0343e8d85321969cd390edb1044791186a1 100644 (file)
@@ -55,7 +55,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1504);
+       define('DB_UPDATE_VERSION', 1505);
 }
 
 return [
@@ -889,6 +889,18 @@ return [
                        "uid" => ["uid"],
                ]
        ],
+       "key-value" => [
+               "comment" => "A key value storage",
+               "fields" => [
+                       "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
+                       "k" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
+                       "v" => ["type" => "mediumtext", "comment" => ""],
+               ],
+               "indexes" => [
+                       "PRIMARY" => ["id"],
+                       "k" => ["UNIQUE", "k"],
+               ],
+       ],
        "locks" => [
                "comment" => "",
                "fields" => [