-- MySQL dump 10.13  Distrib 5.6.21, for osx10.6 (x86_64)
--
-- Host: localhost    Database: stats_system_csgo
-- ------------------------------------------------------
-- Server version	5.6.21

/*!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 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `admin_group`
--

DROP TABLE IF EXISTS `admin_group`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_group` (
  `admin_group_id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`admin_group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `admin_group_permission`
--

DROP TABLE IF EXISTS `admin_group_permission`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_group_permission` (
  `admin_group_permission_id` int(11) NOT NULL AUTO_INCREMENT,
  `admin_group_id` int(11) NOT NULL,
  `admin_permission_id` int(11) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`admin_group_permission_id`),
  KEY `admin_group_permission_admin_group_id` (`admin_group_id`),
  KEY `admin_group_permission_admin_permission_id` (`admin_permission_id`),
  CONSTRAINT `admin_group_permission_admin_group_id` FOREIGN KEY (`admin_group_id`) REFERENCES `admin_group` (`admin_group_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `admin_group_permission_admin_permission_id` FOREIGN KEY (`admin_permission_id`) REFERENCES `admin_permission` (`admin_permission_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=1862 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `admin_permission`
--

DROP TABLE IF EXISTS `admin_permission`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_permission` (
  `admin_permission_id` int(11) NOT NULL AUTO_INCREMENT,
  `class` varchar(30) NOT NULL,
  `method` varchar(50) NOT NULL,
  `label` varchar(30) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`admin_permission_id`)
) ENGINE=InnoDB AUTO_INCREMENT=157 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `admin_session`
--

DROP TABLE IF EXISTS `admin_session`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_session` (
  `session_id` varchar(40) NOT NULL DEFAULT '0',
  `ip_address` varchar(45) NOT NULL DEFAULT '0',
  `user_agent` varchar(120) NOT NULL,
  `last_activity` int(10) unsigned NOT NULL DEFAULT '0',
  `user_data` text NOT NULL,
  PRIMARY KEY (`session_id`),
  KEY `last_activity_idx` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `admin_user`
--

DROP TABLE IF EXISTS `admin_user`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin_user` (
  `admin_user_id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `status` int(1) NOT NULL,
  `last_login` int(11) NOT NULL,
  `last_ip` varchar(15) NOT NULL,
  `admin_group_id` int(11) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `local_timezone` varchar(100) NOT NULL,
  PRIMARY KEY (`admin_user_id`),
  KEY `admin_users_group_id` (`admin_group_id`),
  CONSTRAINT `admin_users_group_id` FOREIGN KEY (`admin_group_id`) REFERENCES `admin_group` (`admin_group_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `api_group`
--

DROP TABLE IF EXISTS `api_group`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `api_group` (
  `api_group_id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`api_group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `api_group_permission`
--

DROP TABLE IF EXISTS `api_group_permission`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `api_group_permission` (
  `api_group_permission_id` int(11) NOT NULL AUTO_INCREMENT,
  `api_group_id` int(11) NOT NULL,
  `api_permission_id` int(11) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`api_group_permission_id`),
  KEY `api_group_permission_api_group_id` (`api_group_id`),
  KEY `api_group_permission_api_permission_id` (`api_permission_id`),
  CONSTRAINT `api_group_permission_api_group_id` FOREIGN KEY (`api_group_id`) REFERENCES `api_group` (`api_group_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `api_group_permission_api_permission_id` FOREIGN KEY (`api_permission_id`) REFERENCES `api_permission` (`api_permission_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=296 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `api_permission`
--

DROP TABLE IF EXISTS `api_permission`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `api_permission` (
  `api_permission_id` int(11) NOT NULL AUTO_INCREMENT,
  `class` varchar(30) NOT NULL,
  `method` varchar(30) NOT NULL,
  `label` varchar(30) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`api_permission_id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `api_user`
--

DROP TABLE IF EXISTS `api_user`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `api_user` (
  `api_user_id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `status` int(1) NOT NULL,
  `last_login` int(11) NOT NULL,
  `last_ip` varchar(15) NOT NULL,
  `api_group_id` int(11) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`api_user_id`),
  KEY `api_users_group_id` (`api_group_id`),
  CONSTRAINT `api_users_group_id` FOREIGN KEY (`api_group_id`) REFERENCES `api_group` (`api_group_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `api_user_event`
--

DROP TABLE IF EXISTS `api_user_event`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `api_user_event` (
  `api_user_event_id` int(11) NOT NULL AUTO_INCREMENT,
  `ip_address` varchar(15) NOT NULL,
  `type` int(2) NOT NULL,
  `controller` varchar(30) NOT NULL,
  `method` varchar(30) NOT NULL,
  `timestamp` int(11) NOT NULL,
  `user_name` varchar(30) NOT NULL,
  `target_id` int(11) NOT NULL,
  `data` longtext NOT NULL,
  PRIMARY KEY (`api_user_event_id`)
) ENGINE=InnoDB AUTO_INCREMENT=59351 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `api_user_game_permission`
--

DROP TABLE IF EXISTS `api_user_game_permission`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `api_user_game_permission` (
  `api_user_game_permission_id` int(11) NOT NULL AUTO_INCREMENT,
  `api_user_id` int(11) NOT NULL,
  `game_id` int(11) NOT NULL,
  PRIMARY KEY (`api_user_game_permission_id`),
  KEY `api_user_game_permission_api_user_idx` (`api_user_id`),
  KEY `api_user_game_permission_game_id_idx` (`game_id`),
  CONSTRAINT `api_user_game_permission_api_user` FOREIGN KEY (`api_user_id`) REFERENCES `api_user` (`api_user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `api_user_game_permission_game_id` FOREIGN KEY (`game_id`) REFERENCES `game` (`game_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=417 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `api_user_league_permission`
--

DROP TABLE IF EXISTS `api_user_league_permission`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `api_user_league_permission` (
  `api_user_league_permission_id` int(11) NOT NULL AUTO_INCREMENT,
  `api_user_id` int(11) NOT NULL,
  PRIMARY KEY (`api_user_league_permission_id`),
  KEY `api_user_league_permission_api_user_idx` (`api_user_id`),
  CONSTRAINT `api_user_league_permission_api_user` FOREIGN KEY (`api_user_id`) REFERENCES `api_user` (`api_user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `api_user_tournament_permission`
--

DROP TABLE IF EXISTS `api_user_tournament_permission`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `api_user_tournament_permission` (
  `api_user_tournament_permission_id` int(11) NOT NULL AUTO_INCREMENT,
  `api_user_id` int(11) NOT NULL,
  `tournament_id` int(11) NOT NULL,
  PRIMARY KEY (`api_user_tournament_permission_id`),
  KEY `api_user_tournament_permission_api_user_idx` (`api_user_id`),
  KEY `api_user_tournament_permission_tournament_id_idx` (`tournament_id`),
  CONSTRAINT `api_user_tournament_permission_api_user` FOREIGN KEY (`api_user_id`) REFERENCES `api_user` (`api_user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `api_user_tournament_permission_tournament_id` FOREIGN KEY (`tournament_id`) REFERENCES `tournament` (`tournament_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `country`
--

DROP TABLE IF EXISTS `country`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `country` (
  `country_id` int(11) NOT NULL AUTO_INCREMENT,
  `country_name` varchar(50) NOT NULL,
  `printable_name` varchar(50) NOT NULL,
  `iso` varchar(2) NOT NULL,
  `iso3` varchar(3) NOT NULL,
  `num_code` int(4) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`country_id`)
) ENGINE=InnoDB AUTO_INCREMENT=251 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `game`
--

DROP TABLE IF EXISTS `game`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `game` (
  `game_id` int(11) NOT NULL AUTO_INCREMENT,
  `tournament_id` int(11) DEFAULT NULL,
  `week_number` int(2) NOT NULL,
  `game_number` int(3) NOT NULL,
  `round_number` int(2) DEFAULT NULL,
  `game_round` int(2) DEFAULT NULL,
  `game_type` int(1) NOT NULL,
  `match_type` int(1) NOT NULL,
  `game_duration` int(11) DEFAULT NULL,
  `patch_number` varchar(10) NOT NULL DEFAULT '0',
  `total_kills` int(2) NOT NULL DEFAULT '0',
  `total_deaths` int(2) NOT NULL DEFAULT '0',
  `total_assists` int(3) NOT NULL DEFAULT '0',
  `is_regular_season` tinyint(1) NOT NULL DEFAULT '0',
  `is_playoff` tinyint(1) NOT NULL DEFAULT '0',
  `is_championship` tinyint(1) NOT NULL DEFAULT '0',
  `game_best_of` int(2) DEFAULT NULL,
  `game_datetime` datetime NOT NULL,
  `game_completed` tinyint(1) NOT NULL DEFAULT '0',
  `game_validated` tinyint(1) NOT NULL DEFAULT '0',
  `game_official` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`game_id`),
  KEY `game_tournament_id` (`tournament_id`),
  CONSTRAINT `game_tournament_id` FOREIGN KEY (`tournament_id`) REFERENCES `tournament` (`tournament_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=631 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `item`
--

DROP TABLE IF EXISTS `item`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item` (
  `item_id` int(11) NOT NULL AUTO_INCREMENT,
  `item_name` varchar(50) NOT NULL,
  `item_effect` longtext NOT NULL,
  `cost` int(5) NOT NULL,
  `item_sell` int(4) NOT NULL,
  `image` varchar(140) DEFAULT NULL,
  `image_url` varchar(140) DEFAULT NULL,
  `patch_number` varchar(10) NOT NULL,
  `current_patch` tinyint(1) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`item_id`),
  UNIQUE KEY `ITEM_ID` (`item_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3802 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `item_event`
--

DROP TABLE IF EXISTS `item_event`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_event` (
  `item_event_id` int(11) NOT NULL AUTO_INCREMENT,
  `player_game_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL,
  `after_id` int(11) DEFAULT NULL,
  `before_id` int(11) DEFAULT NULL,
  `item_event_description` varchar(45) NOT NULL,
  `game_time` int(11) NOT NULL,
  PRIMARY KEY (`item_event_id`),
  KEY `item_event_player_game_id` (`player_game_id`),
  KEY `item_event_item_id` (`item_id`),
  CONSTRAINT `item_event_player_game_id` FOREIGN KEY (`player_game_id`) REFERENCES `player_game` (`player_game_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=221836 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `league`
--

DROP TABLE IF EXISTS `league`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `league` (
  `league_id` int(11) NOT NULL AUTO_INCREMENT,
  `league_name` varchar(100) NOT NULL,
  `region_id` int(11) NOT NULL,
  `overseer_id` int(11) NOT NULL,
  `website` varchar(140) DEFAULT NULL,
  `facebook` varchar(140) DEFAULT NULL,
  `twitter` varchar(140) DEFAULT NULL,
  `image` varchar(140) DEFAULT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`league_id`),
  UNIQUE KEY `LEAGUE_ID` (`league_id`),
  KEY `OVERSEER_ID` (`overseer_id`),
  KEY `REGION_NAME` (`region_id`),
  CONSTRAINT `league_overseer_id` FOREIGN KEY (`overseer_id`) REFERENCES `overseer` (`overseer_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `league_region_id` FOREIGN KEY (`region_id`) REFERENCES `region` (`region_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `overseer`
--

DROP TABLE IF EXISTS `overseer`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `overseer` (
  `overseer_id` int(11) NOT NULL AUTO_INCREMENT,
  `overseer_name` varchar(50) NOT NULL,
  `website` varchar(140) DEFAULT NULL,
  `facebook` varchar(140) DEFAULT NULL,
  `twitter` varchar(140) DEFAULT NULL,
  `image` varchar(140) DEFAULT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`overseer_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `patch`
--

DROP TABLE IF EXISTS `patch`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `patch` (
  `patch_number` varchar(10) NOT NULL,
  `release_date` date DEFAULT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`patch_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `player`
--

DROP TABLE IF EXISTS `player`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `player` (
  `player_id` int(11) NOT NULL AUTO_INCREMENT,
  `player_name` varchar(20) NOT NULL,
  `first_name` varchar(30) DEFAULT NULL,
  `last_name` varchar(30) DEFAULT NULL,
  `alias` longtext,
  `country_id` int(11) NOT NULL,
  `status` varchar(10) NOT NULL,
  `other_team_codes` varchar(140) DEFAULT NULL,
  `other_roles` varchar(20) DEFAULT NULL,
  `birthday` date DEFAULT NULL,
  `image` varchar(140) DEFAULT NULL,
  `twitter` varchar(140) DEFAULT NULL,
  `youtube` varchar(140) DEFAULT NULL,
  `facebook` varchar(140) DEFAULT NULL,
  `twitch` varchar(140) DEFAULT NULL,
  `website` varchar(140) DEFAULT NULL,
  `notes` longtext,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`player_id`),
  UNIQUE KEY `PLAYER_ID` (`player_id`),
  KEY `COUNTRY_ISO` (`country_id`),
  KEY `STATUS` (`status`),
  CONSTRAINT `player_country_id` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=496 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `player_game`
--

DROP TABLE IF EXISTS `player_game`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `player_game` (
  `player_game_id` int(11) NOT NULL AUTO_INCREMENT,
  `game_id` int(11) NOT NULL,
  `player_id` int(11) NOT NULL,
  `kills` int(2) NOT NULL DEFAULT '0',
  `deaths` int(2) NOT NULL DEFAULT '0',
  `assists` int(2) NOT NULL DEFAULT '0',
  `headshots` int(3) NOT NULL DEFAULT '0',
  `mvp` int(3) NOT NULL DEFAULT '0',
  `3k` int(2) NOT NULL DEFAULT '0',
  `4k` int(1) NOT NULL DEFAULT '0',
  `5k` int(1) NOT NULL DEFAULT '0',
  `kda` decimal(6,2) DEFAULT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `team_id` int(11) DEFAULT NULL,
  `first_blood_assist` tinyint(1) NOT NULL DEFAULT '0',
  `first_blood_kill` tinyint(1) NOT NULL DEFAULT '0',
  `order_id` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`player_game_id`),
  KEY `player_game_player_id` (`player_id`),
  KEY `player_game_game_id` (`game_id`),
  CONSTRAINT `player_game_game_id` FOREIGN KEY (`game_id`) REFERENCES `game` (`game_id`) ON DELETE CASCADE ON UPDATE NO ACTION,
  CONSTRAINT `player_game_player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`player_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=6520 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `player_kill_event`
--

DROP TABLE IF EXISTS `player_kill_event`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `player_kill_event` (
  `player_kill_event_id` int(11) NOT NULL AUTO_INCREMENT,
  `killer_id` int(11) NOT NULL,
  `assist_1_id` int(11) DEFAULT NULL,
  `assist_2_id` int(11) DEFAULT NULL,
  `assist_3_id` int(11) DEFAULT NULL,
  `assist_4_id` int(11) DEFAULT NULL,
  `victim_id` int(11) NOT NULL,
  `game_time` int(11) NOT NULL,
  `kill_x_pos` int(4) DEFAULT NULL,
  `kill_y_pos` int(4) DEFAULT NULL COMMENT 'kill_x_pos = x position on map kill_y_pos = y position on map',
  PRIMARY KEY (`player_kill_event_id`),
  KEY `player_kill_event_killer_id` (`killer_id`),
  KEY `player_kill_event_assist_1_id` (`assist_1_id`),
  KEY `player_kill_event_assist_2_id` (`assist_2_id`),
  KEY `player_kill_event_assist_3_id` (`assist_3_id`),
  KEY `player_kill_event_assist_4_id` (`assist_4_id`),
  KEY `player_kill_event_victim_id` (`victim_id`),
  CONSTRAINT `player_kill_event_assist_1_id` FOREIGN KEY (`assist_1_id`) REFERENCES `player_game` (`player_game_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `player_kill_event_assist_2_id` FOREIGN KEY (`assist_2_id`) REFERENCES `player_game` (`player_game_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `player_kill_event_assist_3_id` FOREIGN KEY (`assist_3_id`) REFERENCES `player_game` (`player_game_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `player_kill_event_assist_4_id` FOREIGN KEY (`assist_4_id`) REFERENCES `player_game` (`player_game_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `player_kill_event_killer_id` FOREIGN KEY (`killer_id`) REFERENCES `player_game` (`player_game_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `player_kill_event_victim_id` FOREIGN KEY (`victim_id`) REFERENCES `player_game` (`player_game_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=10591 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `player_team`
--

DROP TABLE IF EXISTS `player_team`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `player_team` (
  `player_team_id` int(11) NOT NULL AUTO_INCREMENT,
  `player_id` int(11) NOT NULL,
  `team_id` int(11) NOT NULL,
  `role_id` int(11) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `contract_price` int(7) DEFAULT NULL,
  `contract_start` date DEFAULT NULL,
  `contract_end` date DEFAULT NULL,
  `leave_date` datetime DEFAULT NULL,
  `join_date` datetime DEFAULT NULL,
  `is_current_team` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`player_team_id`),
  KEY `player_team_player_id` (`player_id`),
  KEY `player_team_team_id` (`team_id`),
  CONSTRAINT `player_team_player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`player_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `player_team_team_id` FOREIGN KEY (`team_id`) REFERENCES `team` (`team_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=706 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `prize_pool`
--

DROP TABLE IF EXISTS `prize_pool`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `prize_pool` (
  `prize_pool_id` int(11) NOT NULL AUTO_INCREMENT,
  `league_id` int(11) DEFAULT NULL,
  `tournament_id` int(11) DEFAULT NULL,
  `prize_pool` varchar(12) NOT NULL,
  PRIMARY KEY (`prize_pool_id`),
  KEY `league_id` (`league_id`),
  KEY `tournament_id` (`tournament_id`),
  CONSTRAINT `prize_pool_league` FOREIGN KEY (`league_id`) REFERENCES `league` (`league_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `prize_pool_tournament` FOREIGN KEY (`tournament_id`) REFERENCES `tournament` (`tournament_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `region`
--

DROP TABLE IF EXISTS `region`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `region` (
  `region_id` int(11) NOT NULL AUTO_INCREMENT,
  `region_name` varchar(50) NOT NULL,
  `region_full_name` varchar(50) DEFAULT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`region_name`),
  UNIQUE KEY `REGION_ID` (`region_id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `role`
--

DROP TABLE IF EXISTS `role`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `role` (
  `role_id` int(11) NOT NULL AUTO_INCREMENT,
  `role_name` varchar(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `server_event`
--

DROP TABLE IF EXISTS `server_event`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `server_event` (
  `server_event_id` int(11) NOT NULL AUTO_INCREMENT,
  `ip_address` varchar(15) NOT NULL,
  `type` int(2) NOT NULL,
  `controller` varchar(30) NOT NULL,
  `method` varchar(30) NOT NULL,
  `timestamp` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `target_id` int(11) NOT NULL,
  `data` longtext NOT NULL,
  PRIMARY KEY (`server_event_id`),
  KEY `server_event_user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3496 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `team`
--

DROP TABLE IF EXISTS `team`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `team` (
  `team_id` int(11) NOT NULL AUTO_INCREMENT,
  `team_name` varchar(40) NOT NULL,
  `team_code` varchar(5) DEFAULT NULL,
  `country_id` int(11) NOT NULL DEFAULT '0',
  `status` varchar(10) NOT NULL,
  `region_id` int(11) NOT NULL DEFAULT '0',
  `coach_player_id` int(11) DEFAULT NULL,
  `analyst_player_id` int(11) DEFAULT NULL,
  `manager_player_id` int(11) DEFAULT NULL,
  `team_captain_player_id` int(11) DEFAULT NULL,
  `website` varchar(140) DEFAULT NULL,
  `youtube` varchar(140) DEFAULT NULL,
  `facebook` varchar(140) DEFAULT NULL,
  `twitter` varchar(140) DEFAULT NULL,
  `creation_date` date DEFAULT NULL,
  `logo` varchar(140) DEFAULT NULL,
  `image` varchar(140) DEFAULT NULL,
  `notes` longtext,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `league_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`team_id`),
  KEY `TEAM_NAME` (`team_name`),
  KEY `team_country_id` (`country_id`),
  KEY `team_region_id` (`region_id`),
  KEY `team_analyst_player_id` (`analyst_player_id`),
  KEY `team_league_id` (`league_id`),
  CONSTRAINT `team_country_id` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `team_league_id` FOREIGN KEY (`league_id`) REFERENCES `league` (`league_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `team_region_id` FOREIGN KEY (`region_id`) REFERENCES `region` (`region_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `team_game`
--

DROP TABLE IF EXISTS `team_game`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `team_game` (
  `team_game_id` int(11) NOT NULL AUTO_INCREMENT,
  `team_id` int(11) NOT NULL,
  `game_id` int(11) NOT NULL,
  `map_side` varchar(10) DEFAULT NULL COMMENT 'red/blue',
  `winning_team` int(11) DEFAULT NULL,
  `total_assists` int(3) NOT NULL DEFAULT '0',
  `total_deaths` int(2) NOT NULL DEFAULT '0',
  `total_kills` int(2) NOT NULL DEFAULT '0',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `bombs_planted` int(2) NOT NULL DEFAULT '0',
  `bombs_defused` int(2) NOT NULL DEFAULT '0',
  `rounds_won` int(2) NOT NULL DEFAULT '0',
  PRIMARY KEY (`team_game_id`),
  KEY `team_game_team_id` (`team_id`),
  KEY `team_game_game_id` (`game_id`),
  CONSTRAINT `team_game_game_id` FOREIGN KEY (`game_id`) REFERENCES `game` (`game_id`) ON DELETE CASCADE ON UPDATE NO ACTION,
  CONSTRAINT `team_game_team_id` FOREIGN KEY (`team_id`) REFERENCES `team` (`team_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=1262 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `team_tournament`
--

DROP TABLE IF EXISTS `team_tournament`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `team_tournament` (
  `team_tournament_id` int(11) NOT NULL AUTO_INCREMENT,
  `team_id` int(11) NOT NULL,
  `tournament_id` int(11) NOT NULL,
  `place` int(2) DEFAULT NULL,
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`team_tournament_id`),
  KEY `team_tournament_team_id` (`team_id`),
  KEY `team_tournament_tournament_id` (`tournament_id`),
  CONSTRAINT `team_tournament_team_id` FOREIGN KEY (`team_id`) REFERENCES `team` (`team_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `team_tournament_tournament_id` FOREIGN KEY (`tournament_id`) REFERENCES `tournament` (`tournament_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `tournament`
--

DROP TABLE IF EXISTS `tournament`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tournament` (
  `tournament_id` int(11) NOT NULL AUTO_INCREMENT,
  `tournament_name` varchar(100) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `region_id` int(11) NOT NULL,
  `overseer_id` int(11) NOT NULL,
  `website` varchar(140) DEFAULT NULL,
  `facebook` varchar(140) DEFAULT NULL,
  `twitter` varchar(140) DEFAULT NULL,
  `image` varchar(140) DEFAULT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `notes` text,
  PRIMARY KEY (`tournament_id`),
  KEY `OVERSEER_ID` (`overseer_id`),
  KEY `REGION_NAME` (`region_id`),
  CONSTRAINT `tournament_overseer_id` FOREIGN KEY (`overseer_id`) REFERENCES `overseer` (`overseer_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `tournament_region_id` FOREIGN KEY (`region_id`) REFERENCES `region` (`region_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed
