openvk/install/init-static-db.sql

536 lines
20 KiB
MySQL
Raw Permalink Normal View History

2020-06-07 21:36:36 +03:00
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!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 */;
/*!40101 SET NAMES utf8mb4 */;
2021-02-11 23:03:50 +03:00
START TRANSACTION;
2020-06-07 21:36:36 +03:00
CREATE TABLE `albums` (
`id` bigint(20) UNSIGNED NOT NULL,
`owner` bigint(20) NOT NULL,
2021-05-14 19:06:35 +03:00
`name` varchar(36) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`description` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`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
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `album_relations` (
2021-01-31 01:44:57 +03:00
`collection` bigint(20) UNSIGNED NOT NULL,
`media` bigint(20) UNSIGNED NOT NULL,
2020-06-07 21:36:36 +03:00
`index` bigint(20) UNSIGNED NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
CREATE TABLE `api_tokens` (
`id` bigint(20) UNSIGNED NOT NULL,
`user` bigint(20) NOT NULL,
2021-05-14 19:06:35 +03:00
`secret` char(72) COLLATE utf8mb4_unicode_520_ci NOT NULL,
2021-01-16 23:23:35 +03:00
`deleted` bit(1) NOT NULL DEFAULT b'0'
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
CREATE TABLE `approval_queue` (
`id` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`model` varchar(128) COLLATE utf8mb4_unicode_520_ci NOT NULL,
2021-01-16 23:23:35 +03:00
`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
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `attachments` (
2021-05-14 19:06:35 +03:00
`attachable_type` varchar(64) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`attachable_id` bigint(20) UNSIGNED DEFAULT NULL,
2021-05-14 19:06:35 +03:00
`target_type` varchar(64) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`target_id` bigint(20) UNSIGNED DEFAULT NULL,
`index` bigint(20) UNSIGNED NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
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,
2021-05-14 19:06:35 +03:00
`hash` char(128) COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`deleted` tinyint(4) DEFAULT 0,
2021-05-14 19:06:35 +03:00
`name` varchar(190) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '(no name)',
`performer` varchar(190) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'Unknown',
`genre` varchar(190) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'K-POP',
`lyrics` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`explicit` tinyint(4) NOT NULL DEFAULT 0
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `audio_relations` (
`user` bigint(20) UNSIGNED NOT NULL,
`audio` bigint(20) UNSIGNED NOT NULL,
`index` bigint(20) UNSIGNED NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `comments` (
`id` bigint(20) UNSIGNED NOT NULL,
`owner` bigint(20) NOT NULL,
2021-05-14 19:06:35 +03:00
`model` varchar(128) COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`target` bigint(20) UNSIGNED NOT NULL,
`created` bigint(20) UNSIGNED NOT NULL,
`edited` bigint(20) UNSIGNED DEFAULT NULL,
2021-05-14 19:06:35 +03:00
`content` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
2021-01-16 23:23:35 +03:00
`flags` tinyint(3) UNSIGNED DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`ad` tinyint(1) NOT NULL DEFAULT 0,
`deleted` tinyint(1) DEFAULT 0,
`virtual_id` bigint(20) DEFAULT 0
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `conv_sockets` (
`id` bigint(20) UNSIGNED NOT NULL,
`origin` bigint(20) UNSIGNED NOT NULL,
`modelId` tinyint(3) UNSIGNED NOT NULL,
`destination` bigint(20) UNSIGNED NOT NULL,
`open` bit(1) NOT NULL DEFAULT b'1',
`visible` bit(1) NOT NULL DEFAULT b'1'
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `event_turnouts` (
`user` bigint(20) UNSIGNED NOT NULL,
`event` bigint(20) UNSIGNED NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `groups` (
`id` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`name` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`about` mediumtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`owner` bigint(20) UNSIGNED DEFAULT NULL,
2021-05-14 19:06:35 +03:00
`shortcode` varchar(36) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`verified` tinyint(1) NOT NULL DEFAULT 0,
2021-01-16 23:23:35 +03:00
`type` int(10) UNSIGNED DEFAULT 1,
2020-06-07 21:36:36 +03:00
`closed` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
2021-05-14 19:06:35 +03:00
`block_reason` text COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`wall` int(11) NOT NULL DEFAULT 1
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `group_coadmins` (
`user` bigint(20) UNSIGNED NOT NULL,
`club` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`comment` varchar(36) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`id` bigint(20) NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
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
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `likes` (
`origin` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`model` varchar(128) COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`target` bigint(20) NOT NULL,
`index` bigint(20) UNSIGNED NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `messages` (
`id` bigint(20) NOT NULL,
2021-05-14 19:06:35 +03:00
`sender_type` varchar(64) COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`sender_id` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`recipient_type` varchar(64) COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`recipient_id` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`content` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`created` bigint(20) NOT NULL,
`edited` bigint(20) DEFAULT NULL,
`ad` tinyint(1) NOT NULL DEFAULT 0,
2021-01-16 23:23:35 +03:00
`deleted` tinyint(1) NOT NULL DEFAULT 0,
`unread` tinyint(1) NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `msg_descriptors` (
`message` bigint(20) UNSIGNED NOT NULL,
`socket` bigint(20) UNSIGNED NOT NULL,
2021-01-16 23:23:35 +03:00
`ack` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
2020-06-07 21:36:36 +03:00
`ack_time` bigint(20) UNSIGNED DEFAULT NULL,
2021-01-16 23:23:35 +03:00
`visible` tinyint(3) UNSIGNED NOT NULL DEFAULT 1,
2020-06-07 21:36:36 +03:00
`index` bigint(20) UNSIGNED NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
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,
2021-05-14 19:06:35 +03:00
`name` varchar(256) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`source` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
`cached_content` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`deleted` tinyint(4) NOT NULL DEFAULT 0
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `number_verification` (
`user` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`number` varchar(48) COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`code` mediumint(9) NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `password_resets` (
`id` bigint(20) UNSIGNED NOT NULL,
`profile` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`key` char(64) COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`timestamp` bigint(20) UNSIGNED NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
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,
2021-05-14 19:06:35 +03:00
`hash` char(128) COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`deleted` tinyint(1) NOT NULL DEFAULT 0,
2021-05-14 19:06:35 +03:00
`description` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `posts` (
`id` bigint(20) UNSIGNED NOT NULL,
`owner` bigint(20) NOT NULL,
`wall` bigint(20) NOT NULL,
`virtual_id` bigint(20) UNSIGNED NOT NULL,
`created` bigint(20) UNSIGNED NOT NULL,
`edited` bigint(20) UNSIGNED DEFAULT NULL,
2021-05-14 19:06:35 +03:00
`content` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
2021-01-16 23:23:35 +03:00
`flags` tinyint(3) UNSIGNED DEFAULT NULL,
`nsfw` tinyint(1) NOT NULL DEFAULT 0,
2020-06-07 21:36:36 +03:00
`ad` tinyint(1) NOT NULL DEFAULT 0,
`deleted` tinyint(1) DEFAULT 0
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `profiles` (
`id` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`user` varchar(36) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`first_name` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'Jane',
`last_name` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'Doe',
`pseudo` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`info` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`about` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`status` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`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,
2021-05-14 19:06:35 +03:00
`phone` varchar(36) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`email` varchar(90) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`coins` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`since` datetime NOT NULL,
2021-05-14 19:06:35 +03:00
`block_reason` text COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`verified` tinyint(1) NOT NULL DEFAULT 0,
`reputation` bigint(20) NOT NULL DEFAULT 1000,
2021-05-14 19:06:35 +03:00
`shortcode` varchar(36) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`registering_ip` varchar(256) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '127.0.0.1',
2020-06-07 21:36:36 +03:00
`online` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`birthday` bigint(20) DEFAULT 0,
2021-05-14 19:06:35 +03:00
`hometown` varchar(60) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2021-01-16 23:23:35 +03:00
`polit_views` int(11) DEFAULT 0,
`marital_status` int(11) DEFAULT 0,
2021-05-14 19:06:35 +03:00
`email_contact` varchar(128) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`telegram` varchar(32) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`interests` mediumtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`fav_music` mediumtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`fav_films` mediumtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`fav_shows` mediumtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`fav_books` mediumtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`fav_quote` mediumtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`city` varchar(60) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`address` varchar(60) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`style` varchar(36) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'ovk',
2021-01-16 23:23:35 +03:00
`style_avatar` int(11) DEFAULT 0,
2020-06-07 21:36:36 +03:00
`show_rating` tinyint(1) DEFAULT 1,
`milkshake` tinyint(1) NOT NULL DEFAULT 0,
2021-01-16 23:23:35 +03:00
`nsfw_tolerance` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
2020-06-07 21:36:36 +03:00
`notification_offset` bigint(20) UNSIGNED DEFAULT 0,
2021-01-16 23:23:35 +03:00
`deleted` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
`microblog` tinyint(3) UNSIGNED NOT NULL DEFAULT 0
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `stickerpacks` (
`id` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`slug` varchar(36) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`name` varchar(64) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`description` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`sold` tinyint(4) NOT NULL DEFAULT 0,
`price` bigint(20) UNSIGNED DEFAULT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `stickers` (
`id` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`hash` char(128) COLLATE utf8mb4_unicode_520_ci NOT NULL,
`emojis` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `sticker_relations` (
`sticker` bigint(20) UNSIGNED NOT NULL,
`pack` bigint(20) UNSIGNED NOT NULL,
`index` bigint(20) UNSIGNED NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `subscriptions` (
`follower` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`model` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`target` bigint(20) UNSIGNED NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
CREATE TABLE subscriptions_new (
`handle` bigint(20) UNSIGNED NOT NULL,
`initiator` bigint(20) UNSIGNED NOT NULL,
`targetModel` varchar(128) COLLATE utf8mb4_unicode_520_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_520_ci DEFAULT NULL,
`created` bigint(20) UNSIGNED NOT NULL,
`updated` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `tickets` (
`id` bigint(20) UNSIGNED NOT NULL,
`type` bigint(20) UNSIGNED NOT NULL,
2021-01-16 23:23:35 +03:00
`deleted` tinyint(4) NOT NULL DEFAULT 0,
2020-06-07 21:36:36 +03:00
`user_id` bigint(20) UNSIGNED NOT NULL,
2021-05-14 19:06:35 +03:00
`name` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
`text` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`created` bigint(20) UNSIGNED NOT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
CREATE TABLE `tickets_comments` (
`id` int(11) NOT NULL,
`user_id` bigint(20) UNSIGNED NOT NULL,
`user_type` int(11) NOT NULL DEFAULT 0,
2021-05-14 19:06:35 +03:00
`text` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
2020-06-07 21:36:36 +03:00
`created` int(11) NOT NULL,
2021-01-16 23:23:35 +03:00
`deleted` tinyint(4) NOT NULL DEFAULT 0,
2020-06-07 21:36:36 +03:00
`ticket_id` bigint(20) DEFAULT NULL
2021-05-14 19:06:35 +03:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2021-01-16 23:23:35 +03:00
2020-06-07 21:36:36 +03:00
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,
2021-05-14 19:06:35 +03:00
`hash` char(128) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`link` varchar(64) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
2020-06-07 21:36:36 +03:00
`deleted` tinyint(1) NOT NULL DEFAULT 0,
2021-05-14 19:06:35 +03:00
`description` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`name` varchar(64) COLLATE utf8mb4_unicode_520_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
2020-06-07 21:36:36 +03:00
ALTER TABLE `albums`
ADD PRIMARY KEY (`id`);
ALTER TABLE `album_relations`
2021-02-11 23:03:50 +03:00
ADD PRIMARY KEY (`index`),
ADD KEY `album` (`collection`);
2020-06-07 21:36:36 +03:00
2021-01-16 23:23:35 +03:00
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`);
2020-06-07 21:36:36 +03:00
ALTER TABLE `attachments`
ADD PRIMARY KEY (`index`);
ALTER TABLE `audios`
ADD PRIMARY KEY (`id`);
ALTER TABLE `audio_relations`
ADD UNIQUE KEY `index` (`index`);
ALTER TABLE `comments`
ADD PRIMARY KEY (`id`);
ALTER TABLE `conv_sockets`
ADD UNIQUE KEY `id` (`id`);
ALTER TABLE `groups`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `shortcode` (`shortcode`);
ALTER TABLE `group_coadmins`
ADD PRIMARY KEY (`id`);
2021-01-16 23:23:35 +03:00
ALTER TABLE `ip`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`),
ADD UNIQUE KEY `ip` (`ip`);
2020-06-07 21:36:36 +03:00
ALTER TABLE `likes`
ADD PRIMARY KEY (`index`);
ALTER TABLE `messages`
ADD PRIMARY KEY (`id`);
ALTER TABLE `msg_descriptors`
ADD UNIQUE KEY `index` (`index`);
ALTER TABLE `notes`
ADD PRIMARY KEY (`id`);
ALTER TABLE `number_verification`
ADD PRIMARY KEY (`user`);
ALTER TABLE `password_resets`
ADD PRIMARY KEY (`id`);
ALTER TABLE `photos`
ADD PRIMARY KEY (`id`);
ALTER TABLE `posts`
2021-01-16 23:23:35 +03:00
ADD PRIMARY KEY (`id`),
ADD KEY `wall` (`wall`);
2020-06-07 21:36:36 +03:00
ALTER TABLE `profiles`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `phone` (`phone`),
ADD UNIQUE KEY `email` (`email`),
ADD UNIQUE KEY `shortcode` (`shortcode`),
ADD KEY `user` (`user`);
ALTER TABLE `stickerpacks`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `slug` (`slug`);
ALTER TABLE `stickers`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `hash` (`hash`);
ALTER TABLE `sticker_relations`
ADD PRIMARY KEY (`index`);
2021-01-16 23:23:35 +03:00
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`);
2020-06-07 21:36:36 +03:00
ALTER TABLE `tickets`
ADD PRIMARY KEY (`id`);
ALTER TABLE `tickets_comments`
ADD PRIMARY KEY (`id`);
ALTER TABLE `videos`
ADD PRIMARY KEY (`id`);
ALTER TABLE `albums`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `album_relations`
MODIFY `index` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
2021-01-16 23:23:35 +03:00
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;
2020-06-07 21:36:36 +03:00
ALTER TABLE `attachments`
MODIFY `index` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `audios`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `audio_relations`
MODIFY `index` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `comments`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `conv_sockets`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `groups`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `group_coadmins`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
2021-01-16 23:23:35 +03:00
ALTER TABLE `ip`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
2020-06-07 21:36:36 +03:00
ALTER TABLE `likes`
MODIFY `index` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `messages`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
ALTER TABLE `msg_descriptors`
MODIFY `index` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `notes`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `password_resets`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `photos`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `posts`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `profiles`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `stickerpacks`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `stickers`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `sticker_relations`
MODIFY `index` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `tickets`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `tickets_comments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `videos`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
2021-01-16 23:23:35 +03:00
ALTER TABLE `approval_queue`
ADD CONSTRAINT `approval_queue_ibfk_1` FOREIGN KEY (`assignee`) REFERENCES `profiles` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
2020-06-07 21:36:36 +03:00
2021-02-11 23:03:50 +03:00
COMMIT;
2020-06-07 21:36:36 +03:00
2021-01-16 23:23:35 +03:00
START TRANSACTION;
2020-06-07 21:36:36 +03:00
2021-01-16 23:23:35 +03:00
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);
2020-06-07 21:36:36 +03:00
2021-01-16 23:23:35 +03:00
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');
2020-06-07 21:36:36 +03:00
2021-01-16 23:23:35 +03:00
COMMIT;
2020-06-07 21:36:36 +03:00
2021-01-16 23:23:35 +03:00
/*!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 */;