text: -- phpMyAdmin SQL Dump
  -- version 4.6.6deb5
  -- https://www.phpmyadmin.net/
  --
  -- Хост: localhost:3306
  -- Время создания: Ноя 02 2020 г., 01:10
  -- Версия сервера: 5.7.32-0ubuntu0.18.04.1
  -- Версия PHP: 7.2.24-0ubuntu0.18.04.7
  
  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 */;
  
  --
  -- База данных: `s100`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `available_tags`
  --
  
  CREATE TABLE `available_tags` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `tag` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `comments`
  --
  
  CREATE TABLE `comments` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    `user_id` bigint(20) NOT NULL,
    `rating` bigint(20) NOT NULL DEFAULT '0',
    `answer_id` bigint(20) NOT NULL,
    `post_slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `text` longtext COLLATE utf8mb4_unicode_ci NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `failed_jobs`
  --
  
  CREATE TABLE `failed_jobs` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
    `queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
    `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
    `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
    `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `groups`
  --
  
  CREATE TABLE `groups` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `user_id` bigint(20) NOT NULL,
    `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    `description` longtext COLLATE utf8mb4_unicode_ci,
    `subscribers_count` bigint(20) NOT NULL DEFAULT '0',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `messages`
  --
  
  CREATE TABLE `messages` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `from_name` text COLLATE utf8mb4_unicode_ci NOT NULL,
    `to_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `message` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
    `readed` tinyint(1) NOT NULL DEFAULT '0',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `migrations`
  --
  
  CREATE TABLE `migrations` (
    `id` int(10) UNSIGNED NOT NULL,
    `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `batch` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `notifications`
  --
  
  CREATE TABLE `notifications` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `user_id` bigint(20) NOT NULL,
    `text` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `post_slug` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    `comment_id` bigint(20) DEFAULT NULL,
    `readed` int(1) NOT NULL DEFAULT '0',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `password_resets`
  --
  
  CREATE TABLE `password_resets` (
    `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `created_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `posts`
  --
  
  CREATE TABLE `posts` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    `user_id` bigint(20) UNSIGNED NOT NULL,
    `group_slug` text COLLATE utf8mb4_unicode_ci,
    `votes_up` bigint(20) NOT NULL DEFAULT '0',
    `votes_down` bigint(20) NOT NULL DEFAULT '0',
    `rating` bigint(20) NOT NULL DEFAULT '0',
    `24h_rating` bigint(20) NOT NULL DEFAULT '0',
    `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `excerpt` longtext COLLATE utf8mb4_unicode_ci,
    `excerpt_no_html` text COLLATE utf8mb4_unicode_ci,
    `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `text` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
    `html` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
    `lang` text COLLATE utf8mb4_unicode_ci NOT NULL,
    `comments_count` bigint(20) NOT NULL DEFAULT '0',
    `files` longtext COLLATE utf8mb4_unicode_ci,
    `tags` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `post_tags`
  --
  
  CREATE TABLE `post_tags` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `post_id` bigint(20) UNSIGNED NOT NULL,
    `tag` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `ratings`
  --
  
  CREATE TABLE `ratings` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `user_id` bigint(20) UNSIGNED NOT NULL,
    `post_slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
    `type` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL,
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `sessions`
  --
  
  CREATE TABLE `sessions` (
    `id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `user_id` bigint(20) UNSIGNED DEFAULT NULL,
    `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    `user_agent` text COLLATE utf8mb4_unicode_ci,
    `payload` text COLLATE utf8mb4_unicode_ci NOT NULL,
    `last_activity` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `subscribes`
  --
  
  CREATE TABLE `subscribes` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `master_id` bigint(20) NOT NULL,
    `slave_id` bigint(20) NOT NULL DEFAULT '0',
    `group_slug` tinytext COLLATE utf8mb4_unicode_ci,
    `tag_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `trix_attachments`
  --
  
  CREATE TABLE `trix_attachments` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `field` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `attachable_id` int(10) UNSIGNED DEFAULT NULL,
    `attachable_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `attachment` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `disk` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `is_pending` tinyint(1) NOT NULL DEFAULT '1',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `trix_rich_texts`
  --
  
  CREATE TABLE `trix_rich_texts` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `field` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `model_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `model_id` bigint(20) UNSIGNED NOT NULL,
    `content` text COLLATE utf8mb4_unicode_ci,
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  -- --------------------------------------------------------
  
  --
  -- Структура таблицы `users`
  --
  
  CREATE TABLE `users` (
    `id` bigint(20) UNSIGNED NOT NULL,
    `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `email_verified_at` timestamp NULL DEFAULT NULL,
    `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
    `avatar` tinytext COLLATE utf8mb4_unicode_ci,
    `rating` bigint(20) NOT NULL DEFAULT '0',
    `subscribers` bigint(20) NOT NULL DEFAULT '0',
    `lang` text COLLATE utf8mb4_unicode_ci,
    `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  
  --
  -- Индексы сохранённых таблиц
  --
  
  --
  -- Индексы таблицы `available_tags`
  --
  ALTER TABLE `available_tags`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Индексы таблицы `comments`
  --
  ALTER TABLE `comments`
    ADD PRIMARY KEY (`id`),
    ADD KEY `comments_post_slug_index` (`post_slug`);
  
  --
  -- Индексы таблицы `failed_jobs`
  --
  ALTER TABLE `failed_jobs`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Индексы таблицы `groups`
  --
  ALTER TABLE `groups`
    ADD PRIMARY KEY (`id`),
    ADD KEY `subscribers_count` (`subscribers_count`);
  
  --
  -- Индексы таблицы `messages`
  --
  ALTER TABLE `messages`
    ADD PRIMARY KEY (`id`),
    ADD KEY `messages_from_id_to_id_readed_index` (`readed`),
    ADD KEY `from_name` (`from_name`(255)),
    ADD KEY `to_name` (`to_name`);
  
  --
  -- Индексы таблицы `migrations`
  --
  ALTER TABLE `migrations`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Индексы таблицы `notifications`
  --
  ALTER TABLE `notifications`
    ADD PRIMARY KEY (`id`),
    ADD KEY `user_id` (`id`);
  
  --
  -- Индексы таблицы `password_resets`
  --
  ALTER TABLE `password_resets`
    ADD KEY `password_resets_email_index` (`email`);
  
  --
  -- Индексы таблицы `posts`
  --
  ALTER TABLE `posts`
    ADD PRIMARY KEY (`id`),
    ADD KEY `posts_user_id_foreign` (`user_id`),
    ADD KEY `lang` (`lang`(2)),
    ADD KEY `24h_rating` (`24h_rating`),
    ADD KEY `rating` (`rating`);
  
  --
  -- Индексы таблицы `post_tags`
  --
  ALTER TABLE `post_tags`
    ADD PRIMARY KEY (`id`),
    ADD KEY `post_tags_post_id_foreign` (`post_id`);
  
  --
  -- Индексы таблицы `ratings`
  --
  ALTER TABLE `ratings`
    ADD PRIMARY KEY (`id`),
    ADD KEY `ratings_user_id_type_post_slug_index` (`user_id`,`type`,`post_slug`);
  
  --
  -- Индексы таблицы `sessions`
  --
  ALTER TABLE `sessions`
    ADD UNIQUE KEY `sessions_id_unique` (`id`);
  
  --
  -- Индексы таблицы `subscribes`
  --
  ALTER TABLE `subscribes`
    ADD PRIMARY KEY (`id`),
    ADD KEY `subscribes_master_id_slave_id_group_id_tag_name_index` (`master_id`,`slave_id`,`tag_name`),
    ADD KEY `group_slug` (`group_slug`(25));
  
  --
  -- Индексы таблицы `trix_attachments`
  --
  ALTER TABLE `trix_attachments`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Индексы таблицы `trix_rich_texts`
  --
  ALTER TABLE `trix_rich_texts`
    ADD PRIMARY KEY (`id`),
    ADD KEY `trix_rich_texts_model_type_model_id_index` (`model_type`,`model_id`);
  
  --
  -- Индексы таблицы `users`
  --
  ALTER TABLE `users`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `users_email_unique` (`email`),
    ADD KEY `rating` (`rating`);
  
  --
  -- AUTO_INCREMENT для сохранённых таблиц
  --
  
  --
  -- AUTO_INCREMENT для таблицы `available_tags`
  --
  ALTER TABLE `available_tags`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT для таблицы `comments`
  --
  ALTER TABLE `comments`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=50;
  --
  -- AUTO_INCREMENT для таблицы `failed_jobs`
  --
  ALTER TABLE `failed_jobs`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT для таблицы `groups`
  --
  ALTER TABLE `groups`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
  --
  -- AUTO_INCREMENT для таблицы `messages`
  --
  ALTER TABLE `messages`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
  --
  -- AUTO_INCREMENT для таблицы `migrations`
  --
  ALTER TABLE `migrations`
    MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;
  --
  -- AUTO_INCREMENT для таблицы `notifications`
  --
  ALTER TABLE `notifications`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT для таблицы `posts`
  --
  ALTER TABLE `posts`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6633;
  --
  -- AUTO_INCREMENT для таблицы `post_tags`
  --
  ALTER TABLE `post_tags`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT для таблицы `ratings`
  --
  ALTER TABLE `ratings`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;
  --
  -- AUTO_INCREMENT для таблицы `subscribes`
  --
  ALTER TABLE `subscribes`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;
  --
  -- AUTO_INCREMENT для таблицы `trix_attachments`
  --
  ALTER TABLE `trix_attachments`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
  --
  -- AUTO_INCREMENT для таблицы `trix_rich_texts`
  --
  ALTER TABLE `trix_rich_texts`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
  --
  -- AUTO_INCREMENT для таблицы `users`
  --
  ALTER TABLE `users`
    MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=402;
  --
  -- Ограничения внешнего ключа сохраненных таблиц
  --
  
  --
  -- Ограничения внешнего ключа таблицы `posts`
  --
  ALTER TABLE `posts`
    ADD CONSTRAINT `posts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
  
  --
  -- Ограничения внешнего ключа таблицы `post_tags`
  --
  ALTER TABLE `post_tags`
    ADD CONSTRAINT `post_tags_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`);
  
  --
  -- Ограничения внешнего ключа таблицы `ratings`
  --
  ALTER TABLE `ratings`
    ADD CONSTRAINT `ratings_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
  
  /*!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 */;
  