Better usage of text and mediumtext.

This commit is contained in:
Michael 2017-01-13 22:13:52 +00:00
parent 3af099298c
commit 29ef8d29ce
2 changed files with 63 additions and 62 deletions

View File

@ -31,10 +31,10 @@ CREATE TABLE IF NOT EXISTS `attach` (
`data` longblob NOT NULL, `data` longblob NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`allow_cid` mediumtext, `allow_cid` text,
`allow_gid` mediumtext, `allow_gid` text,
`deny_cid` mediumtext, `deny_cid` text,
`deny_gid` mediumtext, `deny_gid` text,
PRIMARY KEY(`id`) PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -55,7 +55,7 @@ CREATE TABLE IF NOT EXISTS `auth_codes` (
-- --
CREATE TABLE IF NOT EXISTS `cache` ( CREATE TABLE IF NOT EXISTS `cache` (
`k` varbinary(255) NOT NULL, `k` varbinary(255) NOT NULL,
`v` text, `v` mediumtext,
`expire_mode` int(11) NOT NULL DEFAULT 0, `expire_mode` int(11) NOT NULL DEFAULT 0,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`k`), PRIMARY KEY(`k`),
@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS `config` (
`id` int(10) unsigned NOT NULL auto_increment, `id` int(10) unsigned NOT NULL auto_increment,
`cat` varbinary(255) NOT NULL DEFAULT '', `cat` varbinary(255) NOT NULL DEFAULT '',
`k` varbinary(255) NOT NULL DEFAULT '', `k` varbinary(255) NOT NULL DEFAULT '',
`v` text, `v` mediumtext,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
UNIQUE INDEX `cat_k` (`cat`,`k`) UNIQUE INDEX `cat_k` (`cat`,`k`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -172,13 +172,13 @@ CREATE TABLE IF NOT EXISTS `contact` (
`bd` date NOT NULL DEFAULT '0000-00-00', `bd` date NOT NULL DEFAULT '0000-00-00',
`notify_new_posts` tinyint(1) NOT NULL DEFAULT 0, `notify_new_posts` tinyint(1) NOT NULL DEFAULT 0,
`fetch_further_information` tinyint(1) NOT NULL DEFAULT 0, `fetch_further_information` tinyint(1) NOT NULL DEFAULT 0,
`ffi_keyword_blacklist` mediumtext, `ffi_keyword_blacklist` text,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid_name` (`uid`,`name`), INDEX `uid_name` (`uid`,`name`),
INDEX `uid_self` (`uid`,`self`), INDEX `self_uid` (`self`,`uid`),
INDEX `alias_uid` (`alias`(32),`uid`), INDEX `alias_uid` (`alias`(32),`uid`),
INDEX `uid_pending` (`uid`,`pending`), INDEX `pending_uid` (`pending`,`uid`),
INDEX `uid_blocked` (`uid`,`blocked`), INDEX `blocked_uid` (`blocked`,`uid`),
INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`), INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)), INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
INDEX `addr_uid` (`addr`(32),`uid`), INDEX `addr_uid` (`addr`(32),`uid`),
@ -192,12 +192,12 @@ CREATE TABLE IF NOT EXISTS `contact` (
CREATE TABLE IF NOT EXISTS `conv` ( CREATE TABLE IF NOT EXISTS `conv` (
`id` int(10) unsigned NOT NULL auto_increment, `id` int(10) unsigned NOT NULL auto_increment,
`guid` varchar(64) NOT NULL DEFAULT '', `guid` varchar(64) NOT NULL DEFAULT '',
`recips` mediumtext, `recips` text,
`uid` int(11) NOT NULL DEFAULT 0, `uid` int(11) NOT NULL DEFAULT 0,
`creator` varchar(255) NOT NULL DEFAULT '', `creator` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`subject` mediumtext, `subject` text,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid` (`uid`) INDEX `uid` (`uid`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -234,10 +234,10 @@ CREATE TABLE IF NOT EXISTS `event` (
`nofinish` tinyint(1) NOT NULL DEFAULT 0, `nofinish` tinyint(1) NOT NULL DEFAULT 0,
`adjust` tinyint(1) NOT NULL DEFAULT 1, `adjust` tinyint(1) NOT NULL DEFAULT 1,
`ignore` tinyint(1) unsigned NOT NULL DEFAULT 0, `ignore` tinyint(1) unsigned NOT NULL DEFAULT 0,
`allow_cid` mediumtext, `allow_cid` text,
`allow_gid` mediumtext, `allow_gid` text,
`deny_cid` mediumtext, `deny_cid` text,
`deny_gid` mediumtext, `deny_gid` text,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid_start` (`uid`,`start`) INDEX `uid_start` (`uid`,`start`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -394,7 +394,7 @@ CREATE TABLE IF NOT EXISTS `group_member` (
`gid` int(10) unsigned NOT NULL DEFAULT 0, `gid` int(10) unsigned NOT NULL DEFAULT 0,
`contact-id` int(10) unsigned NOT NULL DEFAULT 0, `contact-id` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `cid_contactid` (`cid`,`contact-id`), INDEX `gid_contactid` (`gid`,`contact-id`),
INDEX `uid_contactid` (`uid`,`contact-id`), INDEX `uid_contactid` (`uid`,`contact-id`),
UNIQUE INDEX `uid_gid_contactid` (`uid`,`gid`,`contact-id`) UNIQUE INDEX `uid_gid_contactid` (`uid`,`gid`,`contact-id`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -688,7 +688,7 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
-- --
CREATE TABLE IF NOT EXISTS `oembed` ( CREATE TABLE IF NOT EXISTS `oembed` (
`url` varbinary(255) NOT NULL, `url` varbinary(255) NOT NULL,
`content` text, `content` mediumtext,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`url`), PRIMARY KEY(`url`),
INDEX `created` (`created`) INDEX `created` (`created`)
@ -701,7 +701,7 @@ CREATE TABLE IF NOT EXISTS `parsed_url` (
`url` varbinary(255) NOT NULL, `url` varbinary(255) NOT NULL,
`guessing` tinyint(1) NOT NULL DEFAULT 0, `guessing` tinyint(1) NOT NULL DEFAULT 0,
`oembed` tinyint(1) NOT NULL DEFAULT 0, `oembed` tinyint(1) NOT NULL DEFAULT 0,
`content` text, `content` mediumtext,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`url`,`guessing`,`oembed`), PRIMARY KEY(`url`,`guessing`,`oembed`),
INDEX `created` (`created`) INDEX `created` (`created`)
@ -750,6 +750,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
INDEX `uid_contactid` (`uid`,`contact-id`), INDEX `uid_contactid` (`uid`,`contact-id`),
INDEX `uid_profile` (`uid`,`profile`), INDEX `uid_profile` (`uid`,`profile`),
INDEX `uid_album_created` (`uid`,`album`(32),`created`), INDEX `uid_album_created` (`uid`,`album`(32),`created`),
INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`(64),`created`), INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`(64),`created`),
INDEX `resource-id` (`resource-id`(64)) INDEX `resource-id` (`resource-id`(64))
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -760,16 +761,16 @@ CREATE TABLE IF NOT EXISTS `photo` (
CREATE TABLE IF NOT EXISTS `poll` ( CREATE TABLE IF NOT EXISTS `poll` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
`uid` int(11) NOT NULL DEFAULT 0, `uid` int(11) NOT NULL DEFAULT 0,
`q0` mediumtext, `q0` text,
`q1` mediumtext, `q1` text,
`q2` mediumtext, `q2` text,
`q3` mediumtext, `q3` text,
`q4` mediumtext, `q4` text,
`q5` mediumtext, `q5` text,
`q6` mediumtext, `q6` text,
`q7` mediumtext, `q7` text,
`q8` mediumtext, `q8` text,
`q9` mediumtext, `q9` text,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid` (`uid`) INDEX `uid` (`uid`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -1082,10 +1083,10 @@ CREATE TABLE IF NOT EXISTS `user` (
`expire_notification_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `expire_notification_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`service_class` varchar(32) NOT NULL DEFAULT '', `service_class` varchar(32) NOT NULL DEFAULT '',
`def_gid` int(11) NOT NULL DEFAULT 0, `def_gid` int(11) NOT NULL DEFAULT 0,
`allow_cid` mediumtext, `allow_cid` text,
`allow_gid` mediumtext, `allow_gid` text,
`deny_cid` mediumtext, `deny_cid` text,
`deny_gid` mediumtext, `deny_gid` text,
`openidserver` text, `openidserver` text,
PRIMARY KEY(`uid`), PRIMARY KEY(`uid`),
INDEX `nickname` (`nickname`(32)) INDEX `nickname` (`nickname`(32))

View File

@ -441,10 +441,10 @@ function db_definition($charset) {
"data" => array("type" => "longblob", "not null" => "1"), "data" => array("type" => "longblob", "not null" => "1"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"allow_cid" => array("type" => "mediumtext"), "allow_cid" => array("type" => "text"),
"allow_gid" => array("type" => "mediumtext"), "allow_gid" => array("type" => "text"),
"deny_cid" => array("type" => "mediumtext"), "deny_cid" => array("type" => "text"),
"deny_gid" => array("type" => "mediumtext"), "deny_gid" => array("type" => "text"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
@ -465,7 +465,7 @@ function db_definition($charset) {
$database["cache"] = array( $database["cache"] = array(
"fields" => array( "fields" => array(
"k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"), "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
"v" => array("type" => "text"), "v" => array("type" => "mediumtext"),
"expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
), ),
@ -506,7 +506,7 @@ function db_definition($charset) {
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"), "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""), "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""), "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"v" => array("type" => "text"), "v" => array("type" => "mediumtext"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
@ -582,7 +582,7 @@ function db_definition($charset) {
"bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"), "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
"notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"ffi_keyword_blacklist" => array("type" => "mediumtext"), "ffi_keyword_blacklist" => array("type" => "text"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
@ -602,12 +602,12 @@ function db_definition($charset) {
"fields" => array( "fields" => array(
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"), "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""), "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
"recips" => array("type" => "mediumtext"), "recips" => array("type" => "text"),
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"subject" => array("type" => "mediumtext"), "subject" => array("type" => "text"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
@ -644,10 +644,10 @@ function db_definition($charset) {
"nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"), "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
"ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"), "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
"allow_cid" => array("type" => "mediumtext"), "allow_cid" => array("type" => "text"),
"allow_gid" => array("type" => "mediumtext"), "allow_gid" => array("type" => "text"),
"deny_cid" => array("type" => "mediumtext"), "deny_cid" => array("type" => "text"),
"deny_gid" => array("type" => "mediumtext"), "deny_gid" => array("type" => "text"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
@ -1098,7 +1098,7 @@ function db_definition($charset) {
$database["oembed"] = array( $database["oembed"] = array(
"fields" => array( "fields" => array(
"url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"), "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
"content" => array("type" => "text"), "content" => array("type" => "mediumtext"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
), ),
"indexes" => array( "indexes" => array(
@ -1111,7 +1111,7 @@ function db_definition($charset) {
"url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"), "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
"guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"), "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
"oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"), "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
"content" => array("type" => "text"), "content" => array("type" => "mediumtext"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
), ),
"indexes" => array( "indexes" => array(
@ -1171,16 +1171,16 @@ function db_definition($charset) {
"fields" => array( "fields" => array(
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"), "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"q0" => array("type" => "mediumtext"), "q0" => array("type" => "text"),
"q1" => array("type" => "mediumtext"), "q1" => array("type" => "text"),
"q2" => array("type" => "mediumtext"), "q2" => array("type" => "text"),
"q3" => array("type" => "mediumtext"), "q3" => array("type" => "text"),
"q4" => array("type" => "mediumtext"), "q4" => array("type" => "text"),
"q5" => array("type" => "mediumtext"), "q5" => array("type" => "text"),
"q6" => array("type" => "mediumtext"), "q6" => array("type" => "text"),
"q7" => array("type" => "mediumtext"), "q7" => array("type" => "text"),
"q8" => array("type" => "mediumtext"), "q8" => array("type" => "text"),
"q9" => array("type" => "mediumtext"), "q9" => array("type" => "text"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
@ -1493,10 +1493,10 @@ function db_definition($charset) {
"expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
"service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""), "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"allow_cid" => array("type" => "mediumtext"), "allow_cid" => array("type" => "text"),
"allow_gid" => array("type" => "mediumtext"), "allow_gid" => array("type" => "text"),
"deny_cid" => array("type" => "mediumtext"), "deny_cid" => array("type" => "text"),
"deny_gid" => array("type" => "mediumtext"), "deny_gid" => array("type" => "text"),
"openidserver" => array("type" => "text"), "openidserver" => array("type" => "text"),
), ),
"indexes" => array( "indexes" => array(