diff options
author | Vitaly Takmazov | 2022-12-16 16:08:38 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-12-16 16:08:38 +0300 |
commit | 12d0e240115e8be3451c20ea899be80ad695f823 (patch) | |
tree | 7c45235b48c1d504c9da1c2a49c85a5b40173943 | |
parent | eb5d09b7824b4f63e0616c4526215397940c25ad (diff) |
mysql: baseline full schema to 1.22
23 files changed, 91 insertions, 293 deletions
diff --git a/src/main/resources/db/specific/mariadb/V1.10__favorites_user_uri.sql b/src/main/resources/db/specific/mariadb/V1.10__favorites_user_uri.sql deleted file mode 100644 index 8f382398..00000000 --- a/src/main/resources/db/specific/mariadb/V1.10__favorites_user_uri.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE favorites ADD COLUMN user_uri char(255) DEFAULT NULL; -UPDATE favorites SET user_uri='' WHERE user_uri IS NULL; -ALTER TABLE favorites MODIFY COLUMN user_uri char(255) NOT NULL DEFAULT '';
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.11__increase pm timestamp precision.sql b/src/main/resources/db/specific/mariadb/V1.11__increase pm timestamp precision.sql deleted file mode 100644 index e83eb621..00000000 --- a/src/main/resources/db/specific/mariadb/V1.11__increase pm timestamp precision.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE pm MODIFY COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.12__drop unused tables.sql b/src/main/resources/db/specific/mariadb/V1.12__drop unused tables.sql deleted file mode 100644 index 1599f5f6..00000000 --- a/src/main/resources/db/specific/mariadb/V1.12__drop unused tables.sql +++ /dev/null @@ -1,5 +0,0 @@ -DROP TABLE IF EXISTS messages_votes; -DROP TABLE IF EXISTS reader_links; -DROP TABLE IF EXISTS reader_rss; -DROP TABLE IF EXISTS captcha; -DROP TABLE IF EXISTS captchaimg;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.13__drop unused tables.sql b/src/main/resources/db/specific/mariadb/V1.13__drop unused tables.sql deleted file mode 100644 index c35fc92c..00000000 --- a/src/main/resources/db/specific/mariadb/V1.13__drop unused tables.sql +++ /dev/null @@ -1,5 +0,0 @@ -DROP TABLE IF EXISTS ads_messages; -DROP TABLE IF EXISTS ads_messages_log; -DROP TABLE IF EXISTS presence; -DROP TABLE IF EXISTS friends_facebook; -DROP TABLE IF EXISTS users_refs;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.14__drop broken pm_streams.sql b/src/main/resources/db/specific/mariadb/V1.14__drop broken pm_streams.sql deleted file mode 100644 index 448c5ce2..00000000 --- a/src/main/resources/db/specific/mariadb/V1.14__drop broken pm_streams.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS pm_streams;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.15__drop unused columns add ts for some tables.sql b/src/main/resources/db/specific/mariadb/V1.15__drop unused columns add ts for some tables.sql deleted file mode 100644 index 2350bff2..00000000 --- a/src/main/resources/db/specific/mariadb/V1.15__drop unused columns add ts for some tables.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE subscr_users DROP COLUMN jid; -ALTER TABLE subscr_users DROP COLUMN active; -ALTER TABLE auth ADD COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; -ALTER TABLE mail ADD COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.16__last seen.sql b/src/main/resources/db/specific/mariadb/V1.16__last seen.sql deleted file mode 100644 index 52ca4e90..00000000 --- a/src/main/resources/db/specific/mariadb/V1.16__last seen.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE users ADD COLUMN last_seen timestamp(6) NULL; -UPDATE users SET last_seen=lastmessage;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.17__drop tags column.sql b/src/main/resources/db/specific/mariadb/V1.17__drop tags column.sql deleted file mode 100644 index ebb2d9a6..00000000 --- a/src/main/resources/db/specific/mariadb/V1.17__drop tags column.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE messages_txt DROP COLUMN tags;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.18__increase messages and replies timestamp precision.sql b/src/main/resources/db/specific/mariadb/V1.18__increase messages and replies timestamp precision.sql deleted file mode 100644 index 5b298c46..00000000 --- a/src/main/resources/db/specific/mariadb/V1.18__increase messages and replies timestamp precision.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE replies MODIFY COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; -ALTER TABLE messages MODIFY COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; -ALTER TABLE messages MODIFY COLUMN updated timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; -ALTER TABLE messages_txt MODIFY COLUMN updated_at timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; -ALTER TABLE users MODIFY COLUMN lastmessage timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; diff --git a/src/main/resources/db/specific/mariadb/V1.19__messages_properties.sql b/src/main/resources/db/specific/mariadb/V1.19__messages_properties.sql deleted file mode 100644 index 2bb3baf2..00000000 --- a/src/main/resources/db/specific/mariadb/V1.19__messages_properties.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE messages_properties ( - message_id int(10) unsigned NOT NULL, - property_key varchar(255) NOT NULL, - property_value mediumtext NOT NULL, - UNIQUE KEY message_key(message_id, property_key) -)
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.1__Add updated_at field.sql b/src/main/resources/db/specific/mariadb/V1.1__Add updated_at field.sql deleted file mode 100644 index dac179b1..00000000 --- a/src/main/resources/db/specific/mariadb/V1.1__Add updated_at field.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE messages_txt ADD COLUMN updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP; -ALTER TABLE replies ADD COLUMN updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP; diff --git a/src/main/resources/db/specific/mariadb/V1.20__reply id in messages_properties.sql b/src/main/resources/db/specific/mariadb/V1.20__reply id in messages_properties.sql deleted file mode 100644 index 2ca5e018..00000000 --- a/src/main/resources/db/specific/mariadb/V1.20__reply id in messages_properties.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE messages_properties ADD COLUMN reply_id smallint(5) unsigned NOT NULL
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.21__recreate messages_properties with correct index.sql b/src/main/resources/db/specific/mariadb/V1.21__recreate messages_properties with correct index.sql deleted file mode 100644 index 685318af..00000000 --- a/src/main/resources/db/specific/mariadb/V1.21__recreate messages_properties with correct index.sql +++ /dev/null @@ -1,8 +0,0 @@ -DROP TABLE messages_properties; -CREATE TABLE messages_properties ( - message_id int(10) unsigned NOT NULL, - reply_id smallint(5) unsigned NOT NULL, - property_key varchar(255) NOT NULL, - property_value mediumtext NOT NULL, - UNIQUE KEY message_key(message_id, reply_id, property_key) -)
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.22__increase updated_at precision.sql b/src/main/resources/db/specific/mariadb/V1.22__increase updated_at precision.sql deleted file mode 100644 index 22034ea2..00000000 --- a/src/main/resources/db/specific/mariadb/V1.22__increase updated_at precision.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE replies MODIFY COLUMN updated_at timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; -ALTER TABLE messages_txt MODIFY COLUMN updated_at timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.2__Drop telegram_chats.sql b/src/main/resources/db/specific/mariadb/V1.2__Drop telegram_chats.sql deleted file mode 100644 index c8faee0d..00000000 --- a/src/main/resources/db/specific/mariadb/V1.2__Drop telegram_chats.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO telegram(tg_id, tg_name, loginhash) SELECT chat_id AS tg_id, 'Anonymous', UUID() FROM telegram_chats; -DROP TABLE telegram_chats;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.3__Nullable user_id column in auth table.sql b/src/main/resources/db/specific/mariadb/V1.3__Nullable user_id column in auth table.sql deleted file mode 100644 index ced85ade..00000000 --- a/src/main/resources/db/specific/mariadb/V1.3__Nullable user_id column in auth table.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE auth MODIFY COLUMN user_id int(10) unsigned NULL;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.4__ActivityPub followers.sql b/src/main/resources/db/specific/mariadb/V1.4__ActivityPub followers.sql deleted file mode 100644 index 16b39f62..00000000 --- a/src/main/resources/db/specific/mariadb/V1.4__ActivityPub followers.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE IF NOT EXISTS `followers` ( - `user_id` int(10) unsigned DEFAULT NULL, - `acct` char(64) NOT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - UNIQUE KEY `acct` (`acct`), - foreign key (user_id) references users(id) -);
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.5__Drop acct index.sql b/src/main/resources/db/specific/mariadb/V1.5__Drop acct index.sql deleted file mode 100644 index 58757d88..00000000 --- a/src/main/resources/db/specific/mariadb/V1.5__Drop acct index.sql +++ /dev/null @@ -1,6 +0,0 @@ -ALTER TABLE followers ADD COLUMN `acct_migr` char(64) NOT NULL; -UPDATE followers SET `acct_migr` = `acct`; -ALTER TABLE followers DROP COLUMN `acct`; -ALTER TABLE followers ADD COLUMN `acct` char(64) NOT NULL; -UPDATE followers SET `acct` = `acct_migr`; -ALTER TABLE followers DROP COLUMN `acct_migr`;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.6__user_uri.sql b/src/main/resources/db/specific/mariadb/V1.6__user_uri.sql deleted file mode 100644 index c302907c..00000000 --- a/src/main/resources/db/specific/mariadb/V1.6__user_uri.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE replies ADD COLUMN user_uri char(255) DEFAULT NULL;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.7__reply_uri.sql b/src/main/resources/db/specific/mariadb/V1.7__reply_uri.sql deleted file mode 100644 index 9ec35485..00000000 --- a/src/main/resources/db/specific/mariadb/V1.7__reply_uri.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE replies ADD COLUMN reply_uri char(255) DEFAULT NULL;
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.8__html reply.sql b/src/main/resources/db/specific/mariadb/V1.8__html reply.sql deleted file mode 100644 index 9f939971..00000000 --- a/src/main/resources/db/specific/mariadb/V1.8__html reply.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE replies ADD COLUMN html tinyint(4) NOT NULL DEFAULT '0';
\ No newline at end of file diff --git a/src/main/resources/db/specific/mariadb/V1.9__reply_uri_index.sql b/src/main/resources/db/specific/mariadb/V1.9__reply_uri_index.sql deleted file mode 100644 index 0ee3c77f..00000000 --- a/src/main/resources/db/specific/mariadb/V1.9__reply_uri_index.sql +++ /dev/null @@ -1 +0,0 @@ -create index reply_uri_index on replies(reply_uri)
\ No newline at end of file diff --git a/src/test/resources/db/specific/mariadb/V1.00__schema.sql b/src/test/resources/db/specific/mariadb/V1.22__schema.sql index d30cd9f7..450bc3a7 100644 --- a/src/test/resources/db/specific/mariadb/V1.00__schema.sql +++ b/src/test/resources/db/specific/mariadb/V1.22__schema.sql @@ -1,8 +1,9 @@ --- MySQL dump 10.16 Distrib 10.1.26-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- -- Host: localhost Database: juick -- ------------------------------------------------------ --- Server version 10.1.26-MariaDB-0+deb9u1 +-- Server version 10.5.15-MariaDB-0+deb11u1 + /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; @@ -14,33 +15,6 @@ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -SET GLOBAL SQL_MODE='NO_AUTO_VALUE_ON_ZERO'; --- --- Table structure for table `ads_messages` --- - -DROP TABLE IF EXISTS `ads_messages`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ads_messages` ( - `message_id` int(10) unsigned NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ads_messages_log` --- - -DROP TABLE IF EXISTS `ads_messages_log`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ads_messages_log` ( - `user_id` int(10) unsigned NOT NULL, - `message_id` int(10) unsigned NOT NULL, - `ts` int(10) unsigned NOT NULL DEFAULT '0' -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `android` -- @@ -51,7 +25,7 @@ DROP TABLE IF EXISTS `android`; CREATE TABLE `android` ( `user_id` int(10) unsigned NOT NULL, `regid` char(255) NOT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT current_timestamp(), UNIQUE KEY `regid` (`regid`), KEY `user_id` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -65,10 +39,11 @@ DROP TABLE IF EXISTS `auth`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `auth` ( - `user_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned DEFAULT NULL, `protocol` enum('xmpp','email','sms') NOT NULL, `account` char(64) NOT NULL, - `authcode` char(8) NOT NULL + `authcode` char(8) NOT NULL, + `ts` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -97,41 +72,12 @@ DROP TABLE IF EXISTS `bl_users`; CREATE TABLE `bl_users` ( `user_id` int(10) unsigned NOT NULL, `bl_user_id` int(10) unsigned NOT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`user_id`,`bl_user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `captcha` --- - -DROP TABLE IF EXISTS `captcha`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `captcha` ( - `jid` char(64) NOT NULL, - `hash` char(16) NOT NULL, - `confirmed` tinyint(4) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `captchaimg` --- - -DROP TABLE IF EXISTS `captchaimg`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `captchaimg` ( - `id` char(16) NOT NULL, - `txt` char(6) NOT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `ip` char(16) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- -- Table structure for table `emails` -- @@ -158,10 +104,10 @@ CREATE TABLE `facebook` ( `fb_id` bigint(20) unsigned DEFAULT NULL, `loginhash` char(36) DEFAULT NULL, `access_token` char(255) DEFAULT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT current_timestamp(), `fb_name` char(64) DEFAULT NULL, `fb_link` char(255) DEFAULT NULL, - `crosspost` tinyint(1) unsigned NOT NULL DEFAULT '1', + `crosspost` tinyint(1) unsigned NOT NULL DEFAULT 1, KEY `user_id` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -177,7 +123,8 @@ CREATE TABLE `favorites` ( `user_id` int(10) unsigned NOT NULL, `message_id` int(10) unsigned NOT NULL, `ts` datetime NOT NULL, - `like_id` int(10) unsigned NOT NULL DEFAULT '1', + `like_id` int(10) unsigned NOT NULL DEFAULT 1, + `user_uri` char(255) NOT NULL DEFAULT '', KEY `user_id` (`user_id`), KEY `message_id` (`message_id`), KEY `like_id` (`like_id`) @@ -185,17 +132,19 @@ CREATE TABLE `favorites` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `friends_facebook` +-- Table structure for table `followers` -- -DROP TABLE IF EXISTS `friends_facebook`; +DROP TABLE IF EXISTS `followers`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `friends_facebook` ( - `user_id` int(10) unsigned NOT NULL, - `friend_id` bigint(20) unsigned NOT NULL, - UNIQUE KEY `user_id` (`user_id`,`friend_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +CREATE TABLE `followers` ( + `user_id` int(10) unsigned DEFAULT NULL, + `ts` timestamp NOT NULL DEFAULT current_timestamp(), + `acct` char(64) NOT NULL, + KEY `user_id` (`user_id`), + CONSTRAINT `followers_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -227,7 +176,7 @@ DROP TABLE IF EXISTS `ios`; CREATE TABLE `ios` ( `user_id` int(10) unsigned NOT NULL, `token` char(64) COLLATE utf8mb4_unicode_ci NOT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT current_timestamp(), UNIQUE KEY `token` (`token`), KEY `user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -243,9 +192,9 @@ DROP TABLE IF EXISTS `jids`; CREATE TABLE `jids` ( `user_id` int(10) unsigned DEFAULT NULL, `jid` char(64) NOT NULL, - `active` tinyint(1) NOT NULL DEFAULT '1', + `active` tinyint(1) NOT NULL DEFAULT 1, `loginhash` char(36) DEFAULT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT current_timestamp(), UNIQUE KEY `jid` (`jid`), KEY `user_id` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -275,6 +224,7 @@ DROP TABLE IF EXISTS `mail`; CREATE TABLE `mail` ( `user_id` int(10) unsigned NOT NULL, `hash` char(16) NOT NULL, + `ts` timestamp(6) NOT NULL DEFAULT current_timestamp(6), PRIMARY KEY (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -307,19 +257,19 @@ CREATE TABLE `messages` ( `message_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(10) unsigned NOT NULL, `lang` enum('en','ru','fr','fa','__') NOT NULL DEFAULT '__', - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `replies` smallint(5) unsigned NOT NULL DEFAULT '0', - `maxreplyid` smallint(5) unsigned NOT NULL DEFAULT '0', - `privacy` tinyint(4) NOT NULL DEFAULT '1', - `readonly` tinyint(1) NOT NULL DEFAULT '0', + `ts` timestamp(6) NOT NULL DEFAULT current_timestamp(6), + `replies` smallint(5) unsigned NOT NULL DEFAULT 0, + `maxreplyid` smallint(5) unsigned NOT NULL DEFAULT 0, + `privacy` tinyint(4) NOT NULL DEFAULT 1, + `readonly` tinyint(1) NOT NULL DEFAULT 0, `attach` enum('jpg','mp4','png') DEFAULT NULL, `place_id` int(10) unsigned DEFAULT NULL, `lat` decimal(10,7) DEFAULT NULL, `lon` decimal(10,7) DEFAULT NULL, - `popular` tinyint(4) NOT NULL DEFAULT '0', - `hidden` tinyint(3) unsigned NOT NULL DEFAULT '0', - `likes` smallint(6) NOT NULL DEFAULT '0', - `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `popular` tinyint(4) NOT NULL DEFAULT 0, + `hidden` tinyint(3) unsigned NOT NULL DEFAULT 0, + `likes` smallint(6) NOT NULL DEFAULT 0, + `updated` timestamp(6) NOT NULL DEFAULT current_timestamp(6), PRIMARY KEY (`message_id`), KEY `user_id` (`user_id`), KEY `ts` (`ts`), @@ -346,6 +296,22 @@ CREATE TABLE `messages_access` ( /*!40101 SET character_set_client = @saved_cs_client */; -- +-- Table structure for table `messages_properties` +-- + +DROP TABLE IF EXISTS `messages_properties`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `messages_properties` ( + `message_id` int(10) unsigned NOT NULL, + `reply_id` smallint(5) unsigned NOT NULL, + `property_key` varchar(255) NOT NULL, + `property_value` mediumtext NOT NULL, + UNIQUE KEY `message_key` (`message_id`,`reply_id`,`property_key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- -- Table structure for table `messages_tags` -- @@ -370,29 +336,14 @@ DROP TABLE IF EXISTS `messages_txt`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `messages_txt` ( `message_id` int(10) unsigned NOT NULL, - `tags` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `repliesby` varchar(96) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `txt` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, + `updated_at` timestamp(6) NOT NULL DEFAULT current_timestamp(6), PRIMARY KEY (`message_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `messages_votes` --- - -DROP TABLE IF EXISTS `messages_votes`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `messages_votes` ( - `message_id` int(10) unsigned NOT NULL, - `user_id` int(10) unsigned NOT NULL, - `vote` tinyint(4) NOT NULL DEFAULT '1', - UNIQUE KEY `message_id` (`message_id`,`user_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- -- Table structure for table `messenger` -- @@ -403,7 +354,7 @@ CREATE TABLE `messenger` ( `user_id` int(10) unsigned DEFAULT NULL, `sender_id` bigint(20) NOT NULL, `display_name` char(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT current_timestamp(), `loginhash` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; @@ -423,7 +374,7 @@ CREATE TABLE `places` ( `descr` char(255) DEFAULT NULL, `url` char(128) DEFAULT NULL, `user_id` int(10) unsigned NOT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`place_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -451,7 +402,7 @@ DROP TABLE IF EXISTS `pm`; CREATE TABLE `pm` ( `user_id` int(10) unsigned NOT NULL, `user_id_to` int(10) unsigned NOT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ts` timestamp(6) NOT NULL DEFAULT current_timestamp(6), `txt` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -472,38 +423,6 @@ CREATE TABLE `pm_inroster` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `pm_streams` --- - -DROP TABLE IF EXISTS `pm_streams`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `pm_streams` ( - `user_id` int(10) unsigned NOT NULL, - `user_id_to` int(10) unsigned NOT NULL, - `lastmessage` datetime NOT NULL, - `lastview` datetime DEFAULT NULL, - `unread` smallint(5) unsigned NOT NULL DEFAULT '0', - UNIQUE KEY `user_id` (`user_id`,`user_id_to`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `presence` --- - -DROP TABLE IF EXISTS `presence`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `presence` ( - `user_id` int(10) unsigned NOT NULL, - `jid` char(64) DEFAULT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - UNIQUE KEY `jid` (`jid`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- -- Table structure for table `reactions` -- @@ -517,38 +436,6 @@ CREATE TABLE `reactions` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `reader_links` --- - -DROP TABLE IF EXISTS `reader_links`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `reader_links` ( - `link_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `rss_id` int(10) unsigned NOT NULL, - `url` char(255) NOT NULL, - `title` char(255) NOT NULL, - `ts` datetime NOT NULL, - PRIMARY KEY (`link_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `reader_rss` --- - -DROP TABLE IF EXISTS `reader_rss`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `reader_rss` ( - `rss_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `url` char(255) NOT NULL, - `lastcheck` datetime NOT NULL, - PRIMARY KEY (`rss_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- -- Table structure for table `replies` -- @@ -559,14 +446,19 @@ CREATE TABLE `replies` ( `message_id` int(10) unsigned NOT NULL, `reply_id` smallint(5) unsigned NOT NULL, `user_id` int(10) unsigned NOT NULL, - `replyto` smallint(5) unsigned NOT NULL DEFAULT '0', - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `replyto` smallint(5) unsigned NOT NULL DEFAULT 0, + `ts` timestamp(6) NOT NULL DEFAULT current_timestamp(6), `attach` enum('jpg','mp4','png') COLLATE utf8mb4_unicode_ci DEFAULT NULL, `txt` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, + `updated_at` timestamp(6) NOT NULL DEFAULT current_timestamp(6), + `user_uri` char(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `reply_uri` char(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `html` tinyint(4) NOT NULL DEFAULT 0, KEY `ts` (`ts`), KEY `message_id` (`message_id`), KEY `uid` (`user_id`), - KEY `reply_indx` (`message_id`,`reply_id`) + KEY `reply_indx` (`message_id`,`reply_id`), + KEY `reply_uri_index` (`reply_uri`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -580,7 +472,7 @@ DROP TABLE IF EXISTS `subscr_messages`; CREATE TABLE `subscr_messages` ( `message_id` int(10) unsigned NOT NULL, `suser_id` int(10) unsigned NOT NULL, - `last_read_rid` smallint(5) NOT NULL DEFAULT '0', + `last_read_rid` smallint(5) NOT NULL DEFAULT 0, UNIQUE KEY `message_id` (`message_id`,`suser_id`), KEY `last_read_indx` (`suser_id`,`last_read_rid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -610,9 +502,7 @@ DROP TABLE IF EXISTS `subscr_users`; CREATE TABLE `subscr_users` ( `user_id` int(10) unsigned NOT NULL, `suser_id` int(10) unsigned NOT NULL, - `jid` char(64) DEFAULT NULL, - `active` bit(1) NOT NULL DEFAULT b'1', - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT current_timestamp(), UNIQUE KEY `user_id` (`user_id`,`suser_id`), KEY `suser_id` (`suser_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -629,10 +519,10 @@ CREATE TABLE `tags` ( `tag_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `synonym_id` int(10) unsigned DEFAULT NULL, `name` char(70) CHARACTER SET utf8mb4 DEFAULT NULL, - `top` tinyint(1) unsigned NOT NULL DEFAULT '0', - `noindex` tinyint(1) unsigned NOT NULL DEFAULT '0', - `stat_messages` int(10) unsigned NOT NULL DEFAULT '0', - `stat_users` smallint(5) unsigned NOT NULL DEFAULT '0', + `top` tinyint(1) unsigned NOT NULL DEFAULT 0, + `noindex` tinyint(1) unsigned NOT NULL DEFAULT 0, + `stat_messages` int(10) unsigned NOT NULL DEFAULT 0, + `stat_users` smallint(5) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`tag_id`), KEY `synonym_id` (`synonym_id`), KEY `stat_msg_indx` (`name`,`stat_messages`) @@ -675,25 +565,12 @@ CREATE TABLE `telegram` ( `user_id` int(10) unsigned DEFAULT NULL, `tg_id` bigint(20) NOT NULL, `tg_name` char(64) COLLATE utf8mb4_unicode_ci NOT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT current_timestamp(), `loginhash` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `telegram_chats` --- - -DROP TABLE IF EXISTS `telegram_chats`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `telegram_chats` ( - `chat_id` bigint(20) DEFAULT NULL, - UNIQUE KEY `chat_id` (`chat_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- -- Table structure for table `top_ignore_messages` -- @@ -743,8 +620,8 @@ CREATE TABLE `twitter` ( `access_token` char(64) NOT NULL, `access_token_secret` char(64) NOT NULL, `uname` char(64) NOT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `crosspost` tinyint(1) unsigned NOT NULL DEFAULT '1', + `ts` timestamp NOT NULL DEFAULT current_timestamp(), + `crosspost` tinyint(1) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -758,16 +635,16 @@ DROP TABLE IF EXISTS `useroptions`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `useroptions` ( `user_id` int(10) unsigned NOT NULL, - `jnotify` tinyint(1) NOT NULL DEFAULT '1', - `subscr_active` tinyint(1) NOT NULL DEFAULT '1', + `jnotify` tinyint(1) NOT NULL DEFAULT 1, + `subscr_active` tinyint(1) NOT NULL DEFAULT 1, `off_ts` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `xmppxhtml` tinyint(1) NOT NULL DEFAULT '0', - `subscr_notify` tinyint(1) NOT NULL DEFAULT '1', - `recommendations` tinyint(1) NOT NULL DEFAULT '1', - `privacy_view` tinyint(1) NOT NULL DEFAULT '1', - `privacy_reply` tinyint(1) NOT NULL DEFAULT '1', - `privacy_pm` tinyint(1) NOT NULL DEFAULT '1', - `repliesview` tinyint(1) NOT NULL DEFAULT '0', + `xmppxhtml` tinyint(1) NOT NULL DEFAULT 0, + `subscr_notify` tinyint(1) NOT NULL DEFAULT 1, + `recommendations` tinyint(1) NOT NULL DEFAULT 1, + `privacy_view` tinyint(1) NOT NULL DEFAULT 1, + `privacy_reply` tinyint(1) NOT NULL DEFAULT 1, + `privacy_pm` tinyint(1) NOT NULL DEFAULT 1, + `repliesview` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`user_id`), KEY `recommendations` (`recommendations`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -785,31 +662,18 @@ CREATE TABLE `users` ( `nick` char(64) NOT NULL, `passw` char(32) NOT NULL, `lang` enum('en','ru','fr','fa','__') NOT NULL DEFAULT '__', - `banned` tinyint(3) unsigned NOT NULL DEFAULT '0', - `lastmessage` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `lastpm` int(11) NOT NULL DEFAULT '0', - `lastphoto` int(11) NOT NULL DEFAULT '0', - `karma` smallint(6) NOT NULL DEFAULT '0', + `banned` tinyint(3) unsigned NOT NULL DEFAULT 0, + `lastmessage` timestamp(6) NOT NULL DEFAULT current_timestamp(6), + `lastpm` int(11) NOT NULL DEFAULT 0, + `lastphoto` int(11) NOT NULL DEFAULT 0, + `karma` smallint(6) NOT NULL DEFAULT 0, + `last_seen` timestamp(6) NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `nick` (`nick`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `users_refs` --- - -DROP TABLE IF EXISTS `users_refs`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `users_refs` ( - `user_id` int(10) unsigned NOT NULL, - `ref` int(10) unsigned NOT NULL, - KEY `ref` (`ref`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- -- Table structure for table `users_subscr` -- @@ -818,7 +682,7 @@ DROP TABLE IF EXISTS `users_subscr`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users_subscr` ( `user_id` int(10) unsigned NOT NULL, - `cnt` smallint(5) unsigned NOT NULL DEFAULT '0', + `cnt` smallint(5) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -867,10 +731,10 @@ CREATE TABLE `vk` ( `vk_id` bigint(20) unsigned DEFAULT NULL, `loginhash` char(36) DEFAULT NULL, `access_token` char(128) DEFAULT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT current_timestamp(), `vk_name` char(64) DEFAULT NULL, `vk_link` char(64) NOT NULL, - `crosspost` tinyint(3) unsigned NOT NULL DEFAULT '1', + `crosspost` tinyint(3) unsigned NOT NULL DEFAULT 1, KEY `user_id` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -885,7 +749,7 @@ DROP TABLE IF EXISTS `winphone`; CREATE TABLE `winphone` ( `user_id` int(10) unsigned NOT NULL, `url` char(255) NOT NULL, - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT current_timestamp(), UNIQUE KEY `url` (`url`), KEY `user_id` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -914,4 +778,4 @@ CREATE TABLE `wl_users` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-06-22 7:38:17 +-- Dump completed on 2022-12-16 16:03:20 |