Add key-value table

This commit is contained in:
Philipp 2022-12-29 16:54:08 +01:00
parent c264278c5d
commit 9a10bb4295
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
4 changed files with 50 additions and 2 deletions

View file

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 2023.03-dev (Giant Rhubarb) -- 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 FOREIGN KEY (`suggest-cid`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT=''; ) 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 -- TABLE locks
-- --

View file

@ -40,6 +40,7 @@ Database Tables
| [inbox-status](help/database/db_inbox-status) | Status of ActivityPub inboxes | | [inbox-status](help/database/db_inbox-status) | Status of ActivityPub inboxes |
| [intro](help/database/db_intro) | | | [intro](help/database/db_intro) | |
| [item-uri](help/database/db_item-uri) | URI and GUID for items | | [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) | | | [locks](help/database/db_locks) | |
| [mail](help/database/db_mail) | private messages | | [mail](help/database/db_mail) | private messages |
| [mailacct](help/database/db_mailacct) | Mail account data for fetching mails | | [mailacct](help/database/db_mailacct) | Mail account data for fetching mails |

View file

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

View file

@ -55,7 +55,7 @@
use Friendica\Database\DBA; use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) { if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1504); define('DB_UPDATE_VERSION', 1505);
} }
return [ return [
@ -889,6 +889,18 @@ return [
"uid" => ["uid"], "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" => [ "locks" => [
"comment" => "", "comment" => "",
"fields" => [ "fields" => [