]> git.mxchange.org Git - friendica.git/blobdiff - src/Database/DBStructure.php
Merge pull request #5030 from annando/fix-sql
[friendica.git] / src / Database / DBStructure.php
index 7ab91a6e1104d58a4449e2bd5d1b7c21cded2438..bc12ca7907f32789291ee6102f2209050f02d016 100644 (file)
@@ -207,7 +207,7 @@ class DBStructure
        public static function update($verbose, $action, $install = false, array $tables = null, array $definition = null) {
                if ($action && !$install) {
                        Config::set('system', 'maintenance', 1);
-                       Config::set('system', 'maintenance_reason', L10n::t(': Database update', DBM::date().' '.date('e')));
+                       Config::set('system', 'maintenance_reason', L10n::t('%s: Database update', DBM::date().' '.date('e')));
                }
 
                $errors = '';
@@ -715,16 +715,16 @@ class DBStructure
                                                ]
                                ];
                $database["cache"] = [
-                               "comment" => "Used to store different data that doesn't to be stored for a long time",
+                               "comment" => "Stores temporary data",
                                "fields" => [
-                                               "k" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => ""],
-                                               "v" => ["type" => "mediumtext", "comment" => ""],
-                                               "expire_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
-                                               "updated" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
+                                               "k" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "cache key"],
+                                               "v" => ["type" => "mediumtext", "comment" => "cached serialized value"],
+                                               "expires" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "datetime of cache expiration"],
+                                               "updated" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "datetime of cache insertion"],
                                                ],
                                "indexes" => [
                                                "PRIMARY" => ["k"],
-                                               "expire_mode_updated" => ["expire_mode", "updated"],
+                                               "k_expires" => ["k", "expires"],
                                                ]
                                ];
                $database["challenge"] = [
@@ -788,9 +788,9 @@ class DBStructure
                                                "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
                                                "attag" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
                                                "avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
-                                               "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
-                                               "thumb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
-                                               "micro" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
+                                               "photo" => ["type" => "varchar(255)", "default" => "", "comment" => ""],
+                                               "thumb" => ["type" => "varchar(255)", "default" => "", "comment" => ""],
+                                               "micro" => ["type" => "varchar(255)", "default" => "", "comment" => ""],
                                                "site-pubkey" => ["type" => "text", "comment" => ""],
                                                "issued-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
                                                "dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
@@ -1074,6 +1074,8 @@ class DBStructure
                                                "noscrape" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
                                                "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
                                                "platform" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
+                                               "relay-subscribe" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Has the server subscribed to the relay system"],
+                                               "relay-scope" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => "The scope of messages that the server wants to get"],
                                                "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
                                                "last_poco_query" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
                                                "last_contact" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
@@ -1084,6 +1086,17 @@ class DBStructure
                                                "nurl" => ["UNIQUE", "nurl(190)"],
                                                ]
                                ];
+               $database["gserver-tag"] = [
+                               "comment" => "Tags that the server has subscribed",
+                               "fields" => [
+                                               "gserver-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["gserver" => "id"], "primary" => "1", "comment" => "The id of the gserver"],
+                                               "tag" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "primary" => "1", "comment" => "Tag that the server has subscribed"],
+                                               ],
+                               "indexes" => [
+                                               "PRIMARY" => ["gserver-id", "tag"],
+                                               "tag" => ["tag"],
+                                               ]
+                               ];
                $database["hook"] = [
                                "comment" => "addon hook registry",
                                "fields" => [
@@ -1790,6 +1803,8 @@ class DBStructure
                                                ]
                                ];
 
+               \Friendica\Core\Addon::callHooks('dbstructure_definition', $database);
+
                return $database;
        }
 }