From 6c26dcf1c7c8eac303eaaff8265661286877f55e Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 19 Feb 2018 13:58:04 +0000 Subject: [PATCH] The network is now just a 4 character field --- boot.php | 2 +- database.sql | 36 ++++++++++++++++++------------------ src/Database/DBStructure.php | 34 +++++++++++++++++----------------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/boot.php b/boot.php index 27d8448531..6400274550 100644 --- a/boot.php +++ b/boot.php @@ -39,7 +39,7 @@ define('FRIENDICA_PLATFORM', 'Friendica'); define('FRIENDICA_CODENAME', 'Asparagus'); define('FRIENDICA_VERSION', '3.6-dev'); define('DFRN_PROTOCOL_VERSION', '2.23'); -define('DB_UPDATE_VERSION', 1253); +define('DB_UPDATE_VERSION', 1254); define('NEW_UPDATE_ROUTINE_VERSION', 1170); /** diff --git a/database.sql b/database.sql index 3f568a1dcf..cbce9a5b7e 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 3.6-dev (Asparagus) --- DB_UPDATE_VERSION 1253 +-- DB_UPDATE_VERSION 1254 -- ------------------------------------------ @@ -9,7 +9,7 @@ -- CREATE TABLE IF NOT EXISTS `addon` ( `id` int NOT NULL auto_increment COMMENT '', - `name` varchar(190) NOT NULL DEFAULT '' COMMENT '', + `name` varbinary(190) NOT NULL DEFAULT '' COMMENT '', `version` varchar(255) NOT NULL DEFAULT '' COMMENT '', `installed` boolean NOT NULL DEFAULT '0' COMMENT '', `hidden` boolean NOT NULL DEFAULT '0' COMMENT '', @@ -112,7 +112,7 @@ CREATE TABLE IF NOT EXISTS `contact` ( `remote_self` boolean NOT NULL DEFAULT '0' COMMENT '', `rel` tinyint NOT NULL DEFAULT 0 COMMENT '', `duplex` boolean NOT NULL DEFAULT '0' COMMENT '', - `network` varchar(255) NOT NULL DEFAULT '' COMMENT '', + `network` char(4) NOT NULL DEFAULT '' COMMENT '', `name` varchar(255) NOT NULL DEFAULT '' COMMENT '', `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '', `location` varchar(255) NOT NULL DEFAULT '' COMMENT '', @@ -179,8 +179,8 @@ CREATE TABLE IF NOT EXISTS `contact` ( INDEX `alias_uid` (`alias`(32),`uid`), INDEX `pending_uid` (`pending`,`uid`), INDEX `blocked_uid` (`blocked`,`uid`), - INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`(4),`poll`(64),`archive`), - INDEX `uid_network_batch` (`uid`,`network`(4),`batch`(64)), + INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`), + INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)), INDEX `addr_uid` (`addr`(32),`uid`), INDEX `nurl_uid` (`nurl`(32),`uid`), INDEX `nick_uid` (`nick`(32),`uid`), @@ -265,7 +265,7 @@ CREATE TABLE IF NOT EXISTS `fcontact` ( `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '', `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '', `priority` tinyint NOT NULL DEFAULT 0 COMMENT '', - `network` varchar(32) NOT NULL DEFAULT '' COMMENT '', + `network` char(4) NOT NULL DEFAULT '' COMMENT '', `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '', `pubkey` text COMMENT '', `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '', @@ -326,7 +326,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` ( `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '', `hide` boolean NOT NULL DEFAULT '0' COMMENT '', `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '', - `network` varchar(255) NOT NULL DEFAULT '' COMMENT '', + `network` char(4) NOT NULL DEFAULT '' COMMENT '', `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '', `notify` text COMMENT '', `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '', @@ -337,7 +337,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` ( INDEX `name` (`name`(64)), INDEX `nick` (`nick`(32)), INDEX `addr` (`addr`(64)), - INDEX `hide_network_updated` (`hide`,`network`(4),`updated`), + INDEX `hide_network_updated` (`hide`,`network`,`updated`), INDEX `updated` (`updated`) ) DEFAULT COLLATE utf8mb4_general_ci; @@ -395,7 +395,7 @@ CREATE TABLE IF NOT EXISTS `gserver` ( `registered-users` int NOT NULL DEFAULT 0 COMMENT '', `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '', `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '', - `network` varchar(32) NOT NULL DEFAULT '' COMMENT '', + `network` char(4) NOT NULL DEFAULT '' COMMENT '', `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '', `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '', `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '', @@ -410,12 +410,12 @@ CREATE TABLE IF NOT EXISTS `gserver` ( -- CREATE TABLE IF NOT EXISTS `hook` ( `id` int NOT NULL auto_increment COMMENT '', - `hook` varchar(255) NOT NULL DEFAULT '' COMMENT '', - `file` varchar(255) NOT NULL DEFAULT '' COMMENT '', - `function` varchar(255) NOT NULL DEFAULT '' COMMENT '', + `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT '', + `file` varbinary(200) NOT NULL DEFAULT '' COMMENT '', + `function` varbinary(200) NOT NULL DEFAULT '' COMMENT '', `priority` smallint NOT NULL DEFAULT 0 COMMENT '', PRIMARY KEY(`id`), - UNIQUE INDEX `hook_file_function` (`hook`(50),`file`(80),`function`(60)) + UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`) ) DEFAULT COLLATE utf8mb4_general_ci; -- @@ -500,7 +500,7 @@ CREATE TABLE IF NOT EXISTS `item` ( `origin` boolean NOT NULL DEFAULT '0' COMMENT '', `forum_mode` tinyint NOT NULL DEFAULT 0 COMMENT '', `mention` boolean NOT NULL DEFAULT '0' COMMENT '', - `network` varchar(32) NOT NULL DEFAULT '' COMMENT '', + `network` char(4) NOT NULL DEFAULT '' COMMENT '', `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '', `rendered-html` mediumtext COMMENT '', `global` boolean NOT NULL DEFAULT '0' COMMENT '', @@ -514,8 +514,8 @@ CREATE TABLE IF NOT EXISTS `item` ( INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`), INDEX `uid_created` (`uid`,`created`), INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`), - INDEX `uid_network_received` (`uid`,`network`(4),`received`), - INDEX `uid_network_commented` (`uid`,`network`(4),`commented`), + INDEX `uid_network_received` (`uid`,`network`,`received`), + INDEX `uid_network_commented` (`uid`,`network`,`commented`), INDEX `uid_thrparent` (`uid`,`thr-parent`(190)), INDEX `uid_parenturi` (`uid`,`parent-uri`(190)), INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`), @@ -854,7 +854,7 @@ CREATE TABLE IF NOT EXISTS `push_subscriber` ( CREATE TABLE IF NOT EXISTS `queue` ( `id` int NOT NULL auto_increment COMMENT '', `cid` int NOT NULL DEFAULT 0 COMMENT 'Message receiver', - `network` varchar(32) NOT NULL DEFAULT '' COMMENT 'Receiver\'s network', + `network` char(4) NOT NULL DEFAULT '' COMMENT 'Receiver\'s network', `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Unique GUID of the message', `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date, when the message was created', `last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last trial', @@ -970,7 +970,7 @@ CREATE TABLE IF NOT EXISTS `thread` ( `origin` boolean NOT NULL DEFAULT '0' COMMENT '', `forum_mode` tinyint NOT NULL DEFAULT 0 COMMENT '', `mention` boolean NOT NULL DEFAULT '0' COMMENT '', - `network` varchar(32) NOT NULL DEFAULT '' COMMENT '', + `network` char(4) NOT NULL DEFAULT '' COMMENT '', PRIMARY KEY(`iid`), INDEX `uid_network_commented` (`uid`,`network`,`commented`), INDEX `uid_network_created` (`uid`,`network`,`created`), diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index 12cf71861d..f87d90d196 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -665,7 +665,7 @@ class DBStructure "comment" => "registered addons", "fields" => [ "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""], - "name" => ["type" => "varchar(190)", "not null" => "1", "default" => "", "comment" => ""], + "name" => ["type" => "varbinary(190)", "not null" => "1", "default" => "", "comment" => ""], "version" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "installed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], @@ -775,7 +775,7 @@ class DBStructure "remote_self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], "rel" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""], "duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], - "network" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], + "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""], "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], @@ -844,8 +844,8 @@ class DBStructure "alias_uid" => ["alias(32)", "uid"], "pending_uid" => ["pending", "uid"], "blocked_uid" => ["blocked", "uid"], - "uid_rel_network_poll" => ["uid", "rel", "network(4)", "poll(64)", "archive"], - "uid_network_batch" => ["uid", "network(4)", "batch(64)"], + "uid_rel_network_poll" => ["uid", "rel", "network", "poll(64)", "archive"], + "uid_network_batch" => ["uid", "network", "batch(64)"], "addr_uid" => ["addr(32)", "uid"], "nurl_uid" => ["nurl(32)", "uid"], "nick_uid" => ["nick(32)", "uid"], @@ -932,7 +932,7 @@ class DBStructure "poll" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "confirm" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "priority" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""], - "network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""], + "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""], "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "pubkey" => ["type" => "text", "comment" => ""], "updated" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""], @@ -996,7 +996,7 @@ class DBStructure "contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "-1", "comment" => ""], "hide" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], "nsfw" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], - "network" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], + "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""], "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "notify" => ["type" => "text", "comment" => ""], "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], @@ -1009,7 +1009,7 @@ class DBStructure "name" => ["name(64)"], "nick" => ["nick(32)"], "addr" => ["addr(64)"], - "hide_network_updated" => ["hide", "network(4)", "updated"], + "hide_network_updated" => ["hide", "network", "updated"], "updated" => ["updated"], ] ]; @@ -1069,7 +1069,7 @@ class DBStructure "registered-users" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""], "poco" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "noscrape" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], - "network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""], + "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""], "platform" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""], "last_poco_query" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""], @@ -1085,14 +1085,14 @@ class DBStructure "comment" => "addon hook registry", "fields" => [ "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""], - "hook" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], - "file" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], - "function" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], + "hook" => ["type" => "varbinary(100)", "not null" => "1", "default" => "", "comment" => ""], + "file" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => ""], + "function" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => ""], "priority" => ["type" => "smallint", "not null" => "1", "default" => "0", "comment" => ""], ], "indexes" => [ "PRIMARY" => ["id"], - "hook_file_function" => ["UNIQUE", "hook(50)","file(80)","function(60)"], + "hook_file_function" => ["UNIQUE", "hook", "file", "function"], ] ]; $database["intro"] = [ @@ -1177,7 +1177,7 @@ class DBStructure "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], "forum_mode" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""], "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], - "network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""], + "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""], "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""], "rendered-html" => ["type" => "mediumtext", "comment" => ""], "global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], @@ -1193,8 +1193,8 @@ class DBStructure "uid_contactid_id" => ["uid","contact-id","id"], "uid_created" => ["uid","created"], "uid_unseen_contactid" => ["uid","unseen","contact-id"], - "uid_network_received" => ["uid","network(4)","received"], - "uid_network_commented" => ["uid","network(4)","commented"], + "uid_network_received" => ["uid","network","received"], + "uid_network_commented" => ["uid","network","commented"], "uid_thrparent" => ["uid","thr-parent(190)"], "uid_parenturi" => ["uid","parent-uri(190)"], "uid_contactid_created" => ["uid","contact-id","created"], @@ -1549,7 +1549,7 @@ class DBStructure "fields" => [ "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""], "cid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Message receiver"], - "network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Receiver's network"], + "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Receiver's network"], "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Unique GUID of the message"], "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date, when the message was created"], "last" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of last trial"], @@ -1671,7 +1671,7 @@ class DBStructure "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], "forum_mode" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""], "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""], - "network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""], + "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""], ], "indexes" => [ "PRIMARY" => ["iid"],