Created
January 10, 2016 09:34
-
-
Save alyphen/a03a4fd82077fc43964d to your computer and use it in GitHub Desktop.
SQL to create tables for coalesce (LD34)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE IF NOT EXISTS `coalesce` DEFAULT CHARACTER SET latin1 COLLATE utf8_general_ci; | |
USE `coalesce`; | |
DROP TABLE IF EXISTS `game`; | |
CREATE TABLE IF NOT EXISTS `game` ( | |
`uuid` varchar(36) NOT NULL, | |
`player1_uuid` varchar(36) NOT NULL, | |
`player2_uuid` varchar(36) NOT NULL, | |
`winner_uuid` varchar(36) NOT NULL, | |
`timestamp` bigint(20) NOT NULL | |
); | |
DROP TABLE IF EXISTS `player`; | |
CREATE TABLE IF NOT EXISTS `player` ( | |
`uuid` varchar(36) NOT NULL, | |
`name` varchar(256) NOT NULL, | |
`password_hash` varchar(256) NOT NULL, | |
`password_salt` varchar(256) NOT NULL, | |
`mmr` double NOT NULL, | |
`rating_deviation` double NOT NULL, | |
`volatility` double NOT NULL, | |
`number_of_results` int(11) NOT NULL | |
); | |
ALTER TABLE `game` | |
ADD PRIMARY KEY (`uuid`), | |
ADD KEY `player1_uuid` (`player1_uuid`,`player2_uuid`,`winner_uuid`), | |
ADD KEY `player1_uuid_2` (`player1_uuid`), | |
ADD KEY `player2_uuid` (`player2_uuid`), | |
ADD KEY `winner_uuid` (`winner_uuid`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment