text: -- phpMyAdmin SQL Dump
  -- version 4.7.4
  -- https://www.phpmyadmin.net/
  --
  -- Host: db
  -- Generation Time: Oct 21, 2017 at 08:14 PM
  -- Server version: 8.0.3-rc-log
  -- PHP Version: 7.0.21
  
  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  SET AUTOCOMMIT = 0;
  START TRANSACTION;
  SET time_zone = "+03: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 */;
  
  --
  -- Database: `pdffiller_quests`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `question_answers`
  --
  
  CREATE TABLE `question_answers` (
    `id` int(11) NOT NULL,
    `user_id` int(11) NOT NULL,
    `quest_id` int(11) NOT NULL,
    `question_id` int(11) NOT NULL,
    `option_id` int(11) DEFAULT NULL,
    `text_answer` varchar(150) DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Table structure for table `question_options`
  --
  
  CREATE TABLE `question_options` (
    `id` int(11) NOT NULL,
    `question_id` int(11) NOT NULL,
    `text` varchar(300) NOT NULL,
    `is_correct` tinyint(1) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Table structure for table `quests`
  --
  
  CREATE TABLE `quests` (
    `id` int(11) NOT NULL,
    `name` varchar(40) NOT NULL,
    `start_text` varchar(200) NOT NULL,
    `end_text` varchar(200) NOT NULL,
    `error_text` varchar(200) NOT NULL,
    `retry_text` varchar(200) NOT NULL,
    `help_text` varchar(300) NOT NULL,
    `max_questions` int(11) NOT NULL,
    `is_default` tinyint(1) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Table structure for table `quest_questions`
  --
  
  CREATE TABLE `quest_questions` (
    `id` int(11) NOT NULL,
    `quest_id` int(11) NOT NULL,
    `order` int(11) NOT NULL,
    `question_text` varchar(300) NOT NULL,
    `type` enum('select','text') NOT NULL DEFAULT 'select',
    `is_required` tinyint(1) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Table structure for table `telegram_users`
  --
  
  CREATE TABLE `telegram_users` (
    `user_id` int(11) NOT NULL,
    `first_name` varchar(40) NOT NULL DEFAULT '',
    `last_name` varchar(40) NOT NULL DEFAULT '',
    `username` varchar(30) NOT NULL DEFAULT '',
    `current_quest_id` int(11) NOT NULL DEFAULT '0',
    `current_question_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `question_answers`
  --
  ALTER TABLE `question_answers`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `question_options`
  --
  ALTER TABLE `question_options`
    ADD PRIMARY KEY (`id`),
    ADD KEY `question index` (`question_id`);
  
  --
  -- Indexes for table `quests`
  --
  ALTER TABLE `quests`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `quest_questions`
  --
  ALTER TABLE `quest_questions`
    ADD PRIMARY KEY (`id`),
    ADD KEY `question_id` (`quest_id`);
  
  --
  -- Indexes for table `telegram_users`
  --
  ALTER TABLE `telegram_users`
    ADD PRIMARY KEY (`user_id`),
    ADD KEY `quest_id` (`current_quest_id`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `question_answers`
  --
  ALTER TABLE `question_answers`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=126;
  
  --
  -- AUTO_INCREMENT for table `question_options`
  --
  ALTER TABLE `question_options`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=85;
  
  --
  -- AUTO_INCREMENT for table `quests`
  --
  ALTER TABLE `quests`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
  
  --
  -- AUTO_INCREMENT for table `quest_questions`
  --
  ALTER TABLE `quest_questions`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26;
  
  --
  -- AUTO_INCREMENT for table `telegram_users`
  --
  ALTER TABLE `telegram_users`
    MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=382786754;
  COMMIT;
  