CREATE TABLE `users` ( `user_id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `username` VARCHAR(20) NOT NULL, `password_hash` CHAR(73) NOT NULL, `signup_date` INT UNSIGNED NOT NULL, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB CHARSET utf8mb4; CREATE TABLE `quest_meta` ( `quest_id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `canon_title` VARCHAR(300) DEFAULT NULL, `ident_title` VARCHAR(300) DEFAULT NULL, `owner_id` SMALLINT UNSIGNED DEFAULT NULL, `open_post_id` SMALLINT UNSIGNED DEFAULT NULL, PRIMARY KEY (`quest_id`) ) ENGINE=InnoDB CHARSET utf8mb4; CREATE TABLE `quest_data` ( `post_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, `quest_id` SMALLINT UNSIGNED NOT NULL, `post_type` ENUM('text', 'dice', 'poll') NOT NULL, `post` MEDIUMTEXT NOT NULL, `timestamp` INT UNSIGNED NOT NULL, PRIMARY KEY (`post_id`) ) ENGINE=InnoDB CHARSET utf8mb4; CREATE TABLE `dice_calls` ( `post_id` MEDIUMINT UNSIGNED NOT NULL, `dice_roll` TEXT NOT NULL, `strict` BOOLEAN DEFAULT FALSE, `dice_challenge` SMALLINT UNSIGNED, `rolls_taken` TINYINT UNSIGNED, PRIMARY KEY (`post_id`) ) ENGINE=InnoDB CHARSET utf8mb4; CREATE TABLE `dice_rolls` ( `message_id` MEDIUMINT UNSIGNED NOT NULL, `quest_id` SMALLINT UNSIGNED NOT NULL, `post_id` MEDIUMINT UNSIGNED NOT NULL, `roll_dice` TEXT NOT NULL, `roll_results` TEXT NOT NULL, `roll_total` SMALLINT UNSIGNED NOT NULL, PRIMARY KEY (`message_id`) ) ENGINE=InnoDB CHARSET utf8mb4; CREATE TABLE `polls` ( `post_id` MEDIUMINT UNSIGNED NOT NULL, `multi_choice` BOOLEAN DEFAULT FALSE, `allow_writein` BOOLEAN DEFAULT FALSE, PRIMARY KEY (`post_id`) ) ENGINE=InnoDB CHARSET utf8mb4; CREATE TABLE `poll_options` ( `post_id` MEDIUMINT UNSIGNED NOT NULL, `quest_id` SMALLINT UNSIGNED NOT NULL, `option_text` VARCHAR(200) NOT NULL, `ips_voted` TEXT DEFAULT NULL ) ENGINE=InnoDB CHARSET utf8mb4; CREATE TABLE `chat_messages` ( `message_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, `room_id` MEDIUMINT UNSIGNED NOT NULL, `name_id` SMALLINT UNSIGNED DEFAULT NULL, `date` INT UNSIGNED NOT NULL, `message` TEXT NOT NULL, PRIMARY KEY (`message_id`) ) ENGINE=InnoDB CHARSET utf8mb4;