text: -- phpMyAdmin SQL Dump
  -- version 4.1.14
  -- http://www.phpmyadmin.net
  --
  -- Host: 127.0.0.1
  -- Generation Time: Jul 04, 2016 at 06:51 PM
  -- Server version: 5.6.17
  -- PHP Version: 5.5.12
  
  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 utf8 */;
  
  --
  -- Database: `avangard`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `game`
  --
  
  CREATE TABLE IF NOT EXISTS `game` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `gameState` enum('waiting','setup','play','over') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'waiting',
    `config` text COLLATE utf8_unicode_ci NOT NULL,
    `boardState` text COLLATE utf8_unicode_ci NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
  
  --
  -- Dumping data for table `game`
  --
  
  INSERT INTO `game` (`id`, `name`, `gameState`, `config`, `boardState`) VALUES
  (1, 'Test', 'setup', '{"disallowed":[[0,1,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,1,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,1,0]],"playerSetup":[[[1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1]]]}', '[[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null]]');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `game_player`
  --
  
  CREATE TABLE IF NOT EXISTS `game_player` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `gameId` int(11) NOT NULL,
    `playerId` int(11) NOT NULL DEFAULT '0',
    `joined` int(11) NOT NULL DEFAULT '0',
    `ready` int(11) NOT NULL DEFAULT '0',
    `lastConnection` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    KEY `player_id` (`playerId`,`joined`),
    KEY `game_id` (`gameId`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  
  --
  -- Dumping data for table `game_player`
  --
  
  INSERT INTO `game_player` (`id`, `gameId`, `playerId`, `joined`, `ready`, `lastConnection`) VALUES
  (1, 1, 1, 1, 0, '2016-07-04 15:51:00'),
  (2, 1, 2, 1, 0, '2016-07-04 15:50:59');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `player`
  --
  
  CREATE TABLE IF NOT EXISTS `player` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `order` int(11) NOT NULL,
    `name` varchar(255) NOT NULL,
    `color` varchar(10) NOT NULL,
    `units` text NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  
  --
  -- Dumping data for table `player`
  --
  
  INSERT INTO `player` (`id`, `order`, `name`, `color`, `units`) VALUES
  (1, 0, 'Player 1', '#ffcccc', '[{"id":1,"amount":3},{"id":2,"amount":4}]'),
  (2, 1, 'Player 2', '#cce6ff', '[{"id":1,"amount":3},{"id":2,"amount":5}]');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `units`
  --
  
  CREATE TABLE IF NOT EXISTS `units` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) NOT NULL,
    `attack` int(11) NOT NULL,
    `health` int(11) NOT NULL,
    `speed` int(11) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  
  --
  -- Dumping data for table `units`
  --
  
  INSERT INTO `units` (`id`, `name`, `attack`, `health`, `speed`) VALUES
  (1, 'Cavalry', 200, 200, 2),
  (2, 'Infantry', 200, 200, 1);
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `game_player`
  --
  ALTER TABLE `game_player`
    ADD CONSTRAINT `game_player_ibfk_1` FOREIGN KEY (`gameId`) REFERENCES `game` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    ADD CONSTRAINT `game_player_ibfk_2` FOREIGN KEY (`playerId`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  /*!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 */;
  