CREATE TABLE `users` (
	`user_id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
	`username` VARCHAR(20) NOT NULL,
	`password_hash` CHAR(73) 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,
	PRIMARY KEY (`quest_id`)
) ENGINE=InnoDB CHARSET utf8mb4;

CREATE TABLE `quest_data` (
	`quest_id` SMALLINT UNSIGNED NOT NULL,
	`post` MEDIUMTEXT NOT NULL,
	`timestamp` INT UNSIGNED NOT NULL
) ENGINE=InnoDB CHARSET utf8mb4;

CREATE TABLE `chat_messages` (
	`room_id` SMALLINT UNSIGNED NOT NULL,
	`name` VARCHAR(20) NOT NULL,
	`name_id` SMALLINT UNSIGNED DEFAULT NULL,
	`date` INT UNSIGNED NOT NULL,
	`message` TEXT NOT NULL
) ENGINE=InnoDB CHARSET utf8mb4;
