From 0cab84a2be46a8ee5a5a13942e1ca506969b2984 Mon Sep 17 00:00:00 2001 From: rem-pai Date: Sat, 16 Jan 2021 22:23:35 +0200 Subject: [PATCH] Update DB dump --- install/init-static-db.sql | 395 ++++++++++++++++++++++++------------- 1 file changed, 256 insertions(+), 139 deletions(-) diff --git a/install/init-static-db.sql b/install/init-static-db.sql index cffd0ef2..1f9e1965 100644 --- a/install/init-static-db.sql +++ b/install/init-static-db.sql @@ -7,75 +7,103 @@ SET time_zone = "+00:00"; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -DROP TABLE IF EXISTS `albums`; CREATE TABLE `albums` ( `id` bigint(20) UNSIGNED NOT NULL, `owner` bigint(20) NOT NULL, - `name` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL, - `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(36) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `description` longtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `access_pragma` tinyint(3) UNSIGNED NOT NULL DEFAULT 255, `cover_photo` bigint(20) UNSIGNED DEFAULT NULL, `special_type` tinyint(3) UNSIGNED NOT NULL DEFAULT 0, `created` bigint(20) UNSIGNED NOT NULL, `edited` bigint(20) UNSIGNED DEFAULT NULL, `deleted` tinyint(1) NOT NULL DEFAULT 0 -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `album_relations`; CREATE TABLE `album_relations` ( `album` bigint(20) UNSIGNED NOT NULL, `photo` bigint(20) UNSIGNED NOT NULL, `index` bigint(20) UNSIGNED NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + + +CREATE TABLE `api_tokens` ( + `id` bigint(20) UNSIGNED NOT NULL, + `user` bigint(20) NOT NULL, + `secret` char(72) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `deleted` bit(1) NOT NULL DEFAULT b'0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + + +CREATE TABLE `approval_queue` ( + `id` bigint(20) UNSIGNED NOT NULL, + `model` varchar(128) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `target` bigint(20) NOT NULL, + `author` bigint(20) UNSIGNED NOT NULL, + `assignee` bigint(20) UNSIGNED DEFAULT NULL, + `status` tinyint(3) UNSIGNED NOT NULL DEFAULT 0, + `created` bigint(20) UNSIGNED NOT NULL, + `updated` bigint(20) UNSIGNED NOT NULL, + `deleted` tinyint(1) NOT NULL DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `attachments`; CREATE TABLE `attachments` ( - `attachable_type` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `attachable_type` varchar(64) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `attachable_id` bigint(20) UNSIGNED DEFAULT NULL, - `target_type` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `target_type` varchar(64) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `target_id` bigint(20) UNSIGNED DEFAULT NULL, `index` bigint(20) UNSIGNED NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `audios`; CREATE TABLE `audios` ( `id` bigint(20) UNSIGNED NOT NULL, `owner` bigint(20) UNSIGNED NOT NULL, `virtual_id` bigint(20) UNSIGNED NOT NULL, `created` bigint(20) UNSIGNED NOT NULL, `edited` bigint(20) UNSIGNED DEFAULT NULL, - `hash` char(128) COLLATE utf8mb4_unicode_ci NOT NULL, + `hash` char(128) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `deleted` tinyint(4) DEFAULT 0, - `name` varchar(190) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '(no name)', - `performer` varchar(190) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Unknown', - `genre` varchar(190) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'K-POP', - `lyrics` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(190) COLLATE utf8mb4_unicode_nopad_ci NOT NULL DEFAULT '(no name)', + `performer` varchar(190) COLLATE utf8mb4_unicode_nopad_ci NOT NULL DEFAULT 'Unknown', + `genre` varchar(190) COLLATE utf8mb4_unicode_nopad_ci NOT NULL DEFAULT 'K-POP', + `lyrics` longtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `explicit` tinyint(4) NOT NULL DEFAULT 0 -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `audio_relations`; CREATE TABLE `audio_relations` ( `user` bigint(20) UNSIGNED NOT NULL, `audio` bigint(20) UNSIGNED NOT NULL, `index` bigint(20) UNSIGNED NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `comments`; CREATE TABLE `comments` ( `id` bigint(20) UNSIGNED NOT NULL, `owner` bigint(20) NOT NULL, - `model` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL, + `model` varchar(128) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `target` bigint(20) UNSIGNED NOT NULL, `created` bigint(20) UNSIGNED NOT NULL, `edited` bigint(20) UNSIGNED DEFAULT NULL, - `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL, - `flags` tinyint(1) UNSIGNED DEFAULT NULL, + `content` longtext COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `flags` tinyint(3) UNSIGNED DEFAULT NULL, `ad` tinyint(1) NOT NULL DEFAULT 0, `deleted` tinyint(1) DEFAULT 0, `virtual_id` bigint(20) DEFAULT 0 -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `conv_sockets`; CREATE TABLE `conv_sockets` ( `id` bigint(20) UNSIGNED NOT NULL, `origin` bigint(20) UNSIGNED NOT NULL, @@ -83,108 +111,133 @@ CREATE TABLE `conv_sockets` ( `destination` bigint(20) UNSIGNED NOT NULL, `open` bit(1) NOT NULL DEFAULT b'1', `visible` bit(1) NOT NULL DEFAULT b'1' -) ENGINE=Aria DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `event_turnouts`; CREATE TABLE `event_turnouts` ( `user` bigint(20) UNSIGNED NOT NULL, `event` bigint(20) UNSIGNED NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `groups`; CREATE TABLE `groups` ( `id` bigint(20) UNSIGNED NOT NULL, - `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `about` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `about` mediumtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `owner` bigint(20) UNSIGNED DEFAULT NULL, - `shortcode` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `shortcode` varchar(36) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `verified` tinyint(1) NOT NULL DEFAULT 0, - `type` int(2) UNSIGNED DEFAULT 1, + `type` int(10) UNSIGNED DEFAULT 1, `closed` tinyint(3) UNSIGNED NOT NULL DEFAULT 0, `wall` int(11) NOT NULL DEFAULT 1 -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `group_coadmins`; CREATE TABLE `group_coadmins` ( `user` bigint(20) UNSIGNED NOT NULL, `club` bigint(20) UNSIGNED NOT NULL, - `comment` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `comment` varchar(36) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `id` bigint(20) NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + + +CREATE TABLE `ip` ( + `id` bigint(20) UNSIGNED NOT NULL, + `ip` varbinary(16) NOT NULL, + `first_seen` bigint(20) UNSIGNED NOT NULL, + `rate_limit_counter_start` bigint(20) UNSIGNED NOT NULL DEFAULT 0, + `rate_limit_counter` tinyint(3) UNSIGNED NOT NULL DEFAULT 0, + `rate_limit_violation_counter_start` bigint(20) UNSIGNED NOT NULL DEFAULT 0, + `rate_limit_violation_counter` tinyint(3) UNSIGNED NOT NULL DEFAULT 0, + `banned` tinyint(1) NOT NULL DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `likes`; CREATE TABLE `likes` ( `origin` bigint(20) UNSIGNED NOT NULL, - `model` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL, + `model` varchar(128) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `target` bigint(20) NOT NULL, `index` bigint(20) UNSIGNED NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `messages`; CREATE TABLE `messages` ( `id` bigint(20) NOT NULL, - `sender_type` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, + `sender_type` varchar(64) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `sender_id` bigint(20) UNSIGNED NOT NULL, - `recipient_type` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, + `recipient_type` varchar(64) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `recipient_id` bigint(20) UNSIGNED NOT NULL, - `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL, + `content` longtext COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `created` bigint(20) NOT NULL, `edited` bigint(20) DEFAULT NULL, `ad` tinyint(1) NOT NULL DEFAULT 0, - `deleted` tinyint(1) NOT NULL DEFAULT 0 -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + `deleted` tinyint(1) NOT NULL DEFAULT 0, + `unread` tinyint(1) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `msg_descriptors`; CREATE TABLE `msg_descriptors` ( `message` bigint(20) UNSIGNED NOT NULL, `socket` bigint(20) UNSIGNED NOT NULL, - `ack` tinyint(1) UNSIGNED NOT NULL DEFAULT 0, + `ack` tinyint(3) UNSIGNED NOT NULL DEFAULT 0, `ack_time` bigint(20) UNSIGNED DEFAULT NULL, - `visible` tinyint(1) UNSIGNED NOT NULL DEFAULT 1, + `visible` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, `index` bigint(20) UNSIGNED NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `notes`; CREATE TABLE `notes` ( `id` bigint(20) UNSIGNED NOT NULL, `owner` bigint(20) NOT NULL, `virtual_id` bigint(20) NOT NULL, `created` bigint(20) NOT NULL, `edited` bigint(20) DEFAULT NULL, - `name` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL, - `source` longtext COLLATE utf8mb4_unicode_ci NOT NULL, - `cached_content` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(256) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `source` longtext COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `cached_content` longtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `deleted` tinyint(4) NOT NULL DEFAULT 0 -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `number_verification`; CREATE TABLE `number_verification` ( `user` bigint(20) UNSIGNED NOT NULL, - `number` varchar(48) COLLATE utf8mb4_unicode_ci NOT NULL, + `number` varchar(48) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `code` mediumint(9) NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `password_resets`; CREATE TABLE `password_resets` ( `id` bigint(20) UNSIGNED NOT NULL, `profile` bigint(20) UNSIGNED NOT NULL, - `key` char(64) COLLATE utf8mb4_unicode_ci NOT NULL, + `key` char(64) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `timestamp` bigint(20) UNSIGNED NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `photos`; CREATE TABLE `photos` ( `id` bigint(20) UNSIGNED NOT NULL, `owner` bigint(20) NOT NULL, `virtual_id` bigint(20) NOT NULL, `created` bigint(20) UNSIGNED NOT NULL, `edited` bigint(20) UNSIGNED DEFAULT NULL, - `hash` char(128) COLLATE utf8mb4_unicode_ci NOT NULL, + `hash` char(128) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `deleted` tinyint(1) NOT NULL DEFAULT 0, - `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + `description` longtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `posts`; CREATE TABLE `posts` ( `id` bigint(20) UNSIGNED NOT NULL, `owner` bigint(20) NOT NULL, @@ -192,124 +245,150 @@ CREATE TABLE `posts` ( `virtual_id` bigint(20) UNSIGNED NOT NULL, `created` bigint(20) UNSIGNED NOT NULL, `edited` bigint(20) UNSIGNED DEFAULT NULL, - `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL, - `flags` tinyint(1) UNSIGNED DEFAULT NULL, + `content` longtext COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `flags` tinyint(3) UNSIGNED DEFAULT NULL, + `nsfw` tinyint(1) NOT NULL DEFAULT 0, `ad` tinyint(1) NOT NULL DEFAULT 0, `deleted` tinyint(1) DEFAULT 0 -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `profiles`; CREATE TABLE `profiles` ( `id` bigint(20) UNSIGNED NOT NULL, - `user` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL, - `first_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Jane', - `last_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Doe', - `pseudo` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `info` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `about` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `status` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `user` varchar(36) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `first_name` varchar(50) COLLATE utf8mb4_unicode_nopad_ci NOT NULL DEFAULT 'Jane', + `last_name` varchar(50) COLLATE utf8mb4_unicode_nopad_ci NOT NULL DEFAULT 'Doe', + `pseudo` varchar(50) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `info` longtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `about` longtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `status` varchar(255) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `privacy` bigint(20) UNSIGNED NOT NULL DEFAULT 1099511627775, `left_menu` bigint(20) UNSIGNED NOT NULL DEFAULT 1099511627775, `sex` tinyint(1) NOT NULL DEFAULT 1, `type` tinyint(4) NOT NULL DEFAULT 0, - `phone` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `email` varchar(90) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `phone` varchar(36) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `email` varchar(90) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `coins` bigint(20) UNSIGNED NOT NULL DEFAULT 0, `since` datetime NOT NULL, - `block_reason` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `block_reason` text COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `verified` tinyint(1) NOT NULL DEFAULT 0, `reputation` bigint(20) NOT NULL DEFAULT 1000, - `shortcode` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `registering_ip` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '127.0.0.1', + `shortcode` varchar(36) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `registering_ip` varchar(256) COLLATE utf8mb4_unicode_nopad_ci NOT NULL DEFAULT '127.0.0.1', `online` bigint(20) UNSIGNED NOT NULL DEFAULT 0, `birthday` bigint(20) DEFAULT 0, - `hometown` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `polit_views` int(2) DEFAULT 0, - `marital_status` int(2) DEFAULT 0, - `email_contact` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `telegram` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `interests` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `fav_music` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `fav_films` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `fav_shows` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `fav_books` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `fav_quote` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `city` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `address` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `style` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT 'ovk', - `style_avatar` int(30) DEFAULT 0, + `hometown` varchar(60) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `polit_views` int(11) DEFAULT 0, + `marital_status` int(11) DEFAULT 0, + `email_contact` varchar(128) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `telegram` varchar(32) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `interests` mediumtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `fav_music` mediumtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `fav_films` mediumtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `fav_shows` mediumtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `fav_books` mediumtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `fav_quote` mediumtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `city` varchar(60) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `address` varchar(60) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `style` varchar(36) COLLATE utf8mb4_unicode_nopad_ci NOT NULL DEFAULT 'ovk', + `style_avatar` int(11) DEFAULT 0, `show_rating` tinyint(1) DEFAULT 1, `milkshake` tinyint(1) NOT NULL DEFAULT 0, + `nsfw_tolerance` tinyint(3) UNSIGNED NOT NULL DEFAULT 0, `notification_offset` bigint(20) UNSIGNED DEFAULT 0, - `deleted` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + `deleted` tinyint(3) UNSIGNED NOT NULL DEFAULT 0, + `microblog` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `stickerpacks`; CREATE TABLE `stickerpacks` ( `id` bigint(20) UNSIGNED NOT NULL, - `slug` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, - `description` longtext COLLATE utf8mb4_unicode_ci NOT NULL, + `slug` varchar(36) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `name` varchar(64) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `description` longtext COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `sold` tinyint(4) NOT NULL DEFAULT 0, `price` bigint(20) UNSIGNED DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `stickers`; CREATE TABLE `stickers` ( `id` bigint(20) UNSIGNED NOT NULL, - `hash` char(128) COLLATE utf8mb4_unicode_ci NOT NULL, - `emojis` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + `hash` char(128) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `emojis` longtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `sticker_relations`; CREATE TABLE `sticker_relations` ( `sticker` bigint(20) UNSIGNED NOT NULL, `pack` bigint(20) UNSIGNED NOT NULL, `index` bigint(20) UNSIGNED NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `subscriptions`; CREATE TABLE `subscriptions` ( `follower` bigint(20) UNSIGNED NOT NULL, - `model` longtext COLLATE utf8mb4_unicode_ci NOT NULL, + `model` longtext COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `target` bigint(20) UNSIGNED NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + + +CREATE TABLE `subscriptions_new` ( + `handle` bigint(20) UNSIGNED NOT NULL, + `initiator` bigint(20) UNSIGNED NOT NULL, + `targetModel` varchar(128) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `targetId` bigint(20) NOT NULL, + `targetWallHandle` bigint(20) NOT NULL, + `shortStatus` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, + `detailedStatus` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, + `listName` varchar(64) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `created` bigint(20) UNSIGNED NOT NULL, + `updated` bigint(20) UNSIGNED NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `tickets`; CREATE TABLE `tickets` ( `id` bigint(20) UNSIGNED NOT NULL, `type` bigint(20) UNSIGNED NOT NULL, - `deleted` tinyint(2) NOT NULL DEFAULT 0, + `deleted` tinyint(4) NOT NULL DEFAULT 0, `user_id` bigint(20) UNSIGNED NOT NULL, - `name` tinytext NOT NULL, - `text` longtext NOT NULL, + `name` text COLLATE utf8mb4_unicode_nopad_ci NOT NULL, + `text` longtext COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `created` bigint(20) UNSIGNED NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `tickets_comments`; CREATE TABLE `tickets_comments` ( `id` int(11) NOT NULL, `user_id` bigint(20) UNSIGNED NOT NULL, `user_type` int(11) NOT NULL DEFAULT 0, - `text` longtext NOT NULL, + `text` longtext COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `created` int(11) NOT NULL, - `deleted` tinyint(2) NOT NULL DEFAULT 0, + `deleted` tinyint(4) NOT NULL DEFAULT 0, `ticket_id` bigint(20) DEFAULT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; + + -DROP TABLE IF EXISTS `videos`; CREATE TABLE `videos` ( `id` bigint(20) UNSIGNED NOT NULL, `owner` bigint(20) NOT NULL, `virtual_id` bigint(20) NOT NULL, `created` bigint(20) UNSIGNED NOT NULL, `edited` bigint(20) UNSIGNED DEFAULT NULL, - `hash` char(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `link` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `hash` char(128) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `link` varchar(64) COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, `deleted` tinyint(1) NOT NULL DEFAULT 0, - `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL -) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + `description` longtext COLLATE utf8mb4_unicode_nopad_ci DEFAULT NULL, + `name` varchar(64) COLLATE utf8mb4_unicode_nopad_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; ALTER TABLE `albums` @@ -318,6 +397,15 @@ ALTER TABLE `albums` ALTER TABLE `album_relations` ADD PRIMARY KEY (`index`); +ALTER TABLE `api_tokens` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `id` (`id`), + ADD KEY `secret` (`secret`); + +ALTER TABLE `approval_queue` + ADD PRIMARY KEY (`id`) USING BTREE, + ADD KEY `approval_queue_ibfk_1` (`assignee`); + ALTER TABLE `attachments` ADD PRIMARY KEY (`index`); @@ -340,6 +428,11 @@ ALTER TABLE `groups` ALTER TABLE `group_coadmins` ADD PRIMARY KEY (`id`); +ALTER TABLE `ip` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `id` (`id`), + ADD UNIQUE KEY `ip` (`ip`); + ALTER TABLE `likes` ADD PRIMARY KEY (`index`); @@ -362,8 +455,8 @@ ALTER TABLE `photos` ADD PRIMARY KEY (`id`); ALTER TABLE `posts` - ADD PRIMARY KEY (`id`); -ALTER TABLE `posts` ADD FULLTEXT KEY `content` (`content`); + ADD PRIMARY KEY (`id`), + ADD KEY `wall` (`wall`); ALTER TABLE `profiles` ADD PRIMARY KEY (`id`), @@ -383,6 +476,13 @@ ALTER TABLE `stickers` ALTER TABLE `sticker_relations` ADD PRIMARY KEY (`index`); +ALTER TABLE `subscriptions_new` + ADD PRIMARY KEY (`handle`), + ADD UNIQUE KEY `handle` (`handle`), + ADD KEY `initiator_index` (`initiator`), + ADD KEY `target_index` (`targetModel`,`targetId`), + ADD KEY `list_index` (`initiator`,`listName`); + ALTER TABLE `tickets` ADD PRIMARY KEY (`id`); @@ -399,6 +499,12 @@ ALTER TABLE `albums` ALTER TABLE `album_relations` MODIFY `index` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; +ALTER TABLE `api_tokens` + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; + +ALTER TABLE `approval_queue` + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; + ALTER TABLE `attachments` MODIFY `index` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; @@ -420,6 +526,9 @@ ALTER TABLE `groups` ALTER TABLE `group_coadmins` MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +ALTER TABLE `ip` + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; + ALTER TABLE `likes` MODIFY `index` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; @@ -453,6 +562,9 @@ ALTER TABLE `stickers` ALTER TABLE `sticker_relations` MODIFY `index` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; +ALTER TABLE `subscriptions_new` + MODIFY `handle` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; + ALTER TABLE `tickets` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; @@ -461,17 +573,22 @@ ALTER TABLE `tickets_comments` ALTER TABLE `videos` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; + + +ALTER TABLE `approval_queue` + ADD CONSTRAINT `approval_queue_ibfk_1` FOREIGN KEY (`assignee`) REFERENCES `profiles` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; +COMMIT; + + +START TRANSACTION; + +INSERT INTO `ChandlerGroups` VALUES (NULL, "OVK\\Subteno", NULL); +INSERT INTO `ChandlerACLRelations` VALUES ("ffffffff-ffff-ffff-ffff-ffffffffffff", (SELECT id FROM ChandlerGroups WHERE name = "OVK\\Subteno"), 64); + +INSERT INTO `profiles` (`id`, `user`, `first_name`, `last_name`, `pseudo`, `info`, `about`, `status`, `privacy`, `left_menu`, `sex`, `type`, `phone`, `email`, `coins`, `since`, `block_reason`, `verified`, `reputation`, `shortcode`, `registering_ip`, `online`, `birthday`, `hometown`, `polit_views`, `marital_status`, `email_contact`, `telegram`, `interests`, `fav_music`, `fav_films`, `fav_shows`, `fav_books`, `fav_quote`, `city`, `address`, `style`, `style_avatar`, `show_rating`, `milkshake`, `nsfw_tolerance`, `notification_offset`, `deleted`, `microblog`) VALUES ('1', 'ffffffff-ffff-ffff-ffff-ffffffffffff', 'System', 'Administrator', NULL, NULL, NULL, 'Default System Administrator account', '1099511627775', '1099511627775', '0', '0', NULL, 'admin@localhost.localdomain6', '100', '2018-10-31 15:15:15', NULL, '1', '1000', 'sysop', '::1', '0', '0', NULL, '0', '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Arcadia Bay', NULL, 'ovk', '0', '1', '0', '0', '0', '0', '0'); + COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; - - - - -INSERT INTO `ChandlerGroups` VALUES ("a8ced6a3-49d8-11ea-bf2f-424d781d39ac", "OVK\Subteno", NULL); - -INSERT INTO `ChandlerACLRelations` VALUES ("ffffffff-ffff-ffff-ffff-ffffffffffff", "a8ced6a3-49d8-11ea-bf2f-424d781d39ac", 16); - -INSERT INTO `profiles` (`id`, `user`, `first_name`, `last_name`, `pseudo`, `info`, `about`, `status`, `privacy`, `left_menu`, `sex`, `type`, `phone`, `email`, `coins`, `since`, `block_reason`, `verified`, `reputation`, `shortcode`, `registering_ip`, `online`, `birthday`, `hometown`, `polit_views`, `marital_status`, `email_contact`, `telegram`, `interests`, `fav_music`, `fav_films`, `fav_shows`, `fav_books`, `fav_quote`, `city`, `address`, `style`, `style_avatar`, `show_rating`, `milkshake`, `notification_offset`, `deleted`) VALUES ('1', 'ffffffff-ffff-ffff-ffff-ffffffffffff', 'System', 'Administrator', 'sysop', NULL, NULL, NULL, '1099511627775', '1099511627775', '1', '0', NULL, 'admin@localhost.localdomain6', '0', '2018-10-31 15:15:15', NULL, '1', '1000', 'sysop', '::1', '0', '0', NULL, '0', '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'ovk', '0', '0', '1', '0', '0');