-- phpMyAdmin SQL Dump
-- version 3.2.0.1
-- http://www.phpmyadmin.net
--
-- Počítač: localhost
-- Vygenerováno: Středa 05. srpna 2009, 08:37
-- Verze MySQL: 5.0.77
-- Verze PHP: 5.2.9

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Databáze: `wowhosting`
--

-- --------------------------------------------------------

--
-- Struktura tabulky `Backup`
--

CREATE TABLE IF NOT EXISTS `Backup` (
  `Id` int(11) NOT NULL auto_increment,
  `Server` int(11) NOT NULL,
  `Time` datetime NOT NULL,
  `Description` varchar(255) NOT NULL,
  `Lock` int(11) NOT NULL,
  `Database` int(11) NOT NULL,
  PRIMARY KEY  (`Id`),
  KEY `Server` (`Server`),
  KEY `Database` (`Database`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=53 ;

-- --------------------------------------------------------

--
-- Struktura tabulky `Client`
--

CREATE TABLE IF NOT EXISTS `Client` (
  `Id` int(11) NOT NULL auto_increment,
  `Version` varchar(16) NOT NULL,
  `BuildNumber` int(11) NOT NULL,
  `ReleaseDate` date NOT NULL,
  `Title` varchar(255) NOT NULL,
  `Patch` varchar(255) NOT NULL,
  PRIMARY KEY  (`Id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=75 ;

-- --------------------------------------------------------

--
-- Struktura tabulky `Database`
--

CREATE TABLE IF NOT EXISTS `Database` (
  `Id` int(11) NOT NULL auto_increment,
  `Name` varchar(255) NOT NULL,
  `Title` varchar(255) NOT NULL,
  `Version` varchar(16) NOT NULL,
  `Revision` int(11) NOT NULL,
  `ScriptDev2Revision` int(11) NOT NULL,
  `ACIDRevision` int(11) NOT NULL,
  `SourceFileName` varchar(255) NOT NULL,
  `Emulator` int(11) default NULL,
  `Update` text NOT NULL,
  `ACIDSourceFileName` varchar(255) NOT NULL,
  PRIMARY KEY  (`Id`),
  KEY `Emulator` (`Emulator`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ;

-- --------------------------------------------------------

--
-- Struktura tabulky `Debug`
--

CREATE TABLE IF NOT EXISTS `Debug` (
  `Id` int(11) NOT NULL auto_increment,
  `Time` datetime NOT NULL,
  `Realm` int(11) NOT NULL,
  `Backtrace` mediumtext NOT NULL,
  `Log` text NOT NULL,
  `MangosVersion` varchar(255) NOT NULL,
  `DbVersion` varchar(255) NOT NULL,
  `MaxPlayerCount` int(11) NOT NULL,
  `Uptime` int(11) NOT NULL,
  `ErrorLog` text NOT NULL,
  `DbErrors` text NOT NULL,
  `Configuration` text NOT NULL,
  PRIMARY KEY  (`Id`),
  KEY `Server` (`Realm`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

-- --------------------------------------------------------

--
-- Struktura tabulky `Emulator`
--

CREATE TABLE IF NOT EXISTS `Emulator` (
  `Id` int(11) NOT NULL auto_increment,
  `Name` varchar(255) NOT NULL,
  `Client` int(11) NOT NULL,
  `Revision` int(11) NOT NULL,
  `CommitHash` varchar(255) NOT NULL COMMENT 'Určeno dle revize z http://github.com/mangos/mangos/commits/master',
  `ScriptDev2PatchFileName` varchar(255) NOT NULL,
  `ScriptDev2Revision` int(11) NOT NULL,
  `Version` varchar(16) NOT NULL,
  `Lock` int(11) NOT NULL,
  `Enable` int(11) NOT NULL,
  PRIMARY KEY  (`Id`),
  KEY `Client` (`Client`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;

-- --------------------------------------------------------

--
-- Struktura tabulky `History`
--

CREATE TABLE IF NOT EXISTS `History` (
  `Time` int(11) NOT NULL,
  `Period` int(11) NOT NULL,
  `Measure` int(11) NOT NULL,
  `Server` int(11) NOT NULL,
  `Minimum` double NOT NULL,
  `Average` double NOT NULL,
  `Maximum` double NOT NULL,
  UNIQUE KEY `Time_2` (`Time`,`Period`,`Measure`,`Server`),
  KEY `Time` (`Time`),
  KEY `Measure` (`Measure`),
  KEY `Server` (`Server`),
  KEY `Period` (`Period`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Struktura tabulky `Log`
--

CREATE TABLE IF NOT EXISTS `Log` (
  `Time` datetime NOT NULL default '0000-00-00 00:00:00',
  `User` int(11) NOT NULL default '0',
  `Module` varchar(64) character set utf8 NOT NULL,
  `Operation` varchar(255) character set utf8 NOT NULL,
  `Value` varchar(255) character set utf8 NOT NULL,
  KEY `Time` (`Time`),
  KEY `User` (`User`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;

-- --------------------------------------------------------

--
-- Struktura tabulky `News`
--

CREATE TABLE IF NOT EXISTS `News` (
  `Id` int(11) NOT NULL auto_increment,
  `User` int(11) NOT NULL,
  `Time` datetime NOT NULL,
  `Title` varchar(255) NOT NULL,
  `Content` text NOT NULL,
  PRIMARY KEY  (`Id`),
  KEY `User` (`User`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;

-- --------------------------------------------------------

--
-- Struktura tabulky `Realm`
--

CREATE TABLE IF NOT EXISTS `Realm` (
  `Id` int(11) NOT NULL auto_increment,
  `Name` varchar(255) NOT NULL,
  `Server` int(11) NOT NULL,
  `NetworkPortWorldd` int(11) NOT NULL,
  `Database` int(11) NOT NULL,
  `Motd` varchar(255) NOT NULL,
  `Description` text NOT NULL,
  `Type` int(11) NOT NULL,
  `Homepage` varchar(255) NOT NULL,
  `TimeCreate` datetime NOT NULL,
  `Online` int(11) NOT NULL,
  `CharacterOnlineCount` int(11) NOT NULL,
  `CharacterCount` int(11) NOT NULL,
  `AccountCount` int(11) NOT NULL,
  `Lock` int(11) NOT NULL,
  PRIMARY KEY  (`Id`),
  KEY `Database` (`Database`),
  KEY `Server` (`Server`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ;

-- --------------------------------------------------------

--
-- Struktura tabulky `RealmLog`
--

CREATE TABLE IF NOT EXISTS `RealmLog` (
  `Id` int(11) NOT NULL auto_increment,
  `Realm` int(11) NOT NULL,
  `Time` datetime NOT NULL,
  `Text` text NOT NULL,
  PRIMARY KEY  (`Id`),
  KEY `Server` (`Realm`),
  KEY `Time` (`Time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Struktura tabulky `Server`
--

CREATE TABLE IF NOT EXISTS `Server` (
  `Id` int(11) NOT NULL auto_increment,
  `Name` varchar(255) NOT NULL,
  `NetworkPortRealmd` int(11) NOT NULL,
  `User` int(11) NOT NULL,
  `Database` int(11) NOT NULL,
  `Description` text NOT NULL,
  `Homepage` varchar(255) NOT NULL,
  `TimeCreate` datetime NOT NULL,
  `Online` int(11) NOT NULL,
  `CharacterOnlineCount` int(11) NOT NULL,
  `CharacterCount` int(11) NOT NULL,
  `AccountCount` int(11) NOT NULL,
  `Lock` int(11) NOT NULL,
  `Started` int(11) NOT NULL,
  PRIMARY KEY  (`Id`),
  KEY `User` (`User`),
  KEY `Database` (`Database`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=23 ;

-- --------------------------------------------------------

--
-- Struktura tabulky `Task`
--

CREATE TABLE IF NOT EXISTS `Task` (
  `Id` int(11) NOT NULL auto_increment,
  `TimeCreate` datetime default NULL,
  `TimeStart` datetime default NULL,
  `TimeEnd` datetime default NULL,
  `Title` varchar(255) NOT NULL,
  `CommandList` text NOT NULL,
  `User` int(11) default NULL,
  `State` int(11) NOT NULL,
  `Output` text NOT NULL,
  `Error` text NOT NULL,
  PRIMARY KEY  (`Id`),
  KEY `User` (`User`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ;

-- --------------------------------------------------------

--
-- Struktura tabulky `User`
--

CREATE TABLE IF NOT EXISTS `User` (
  `Id` int(11) NOT NULL auto_increment,
  `Name` varchar(255) NOT NULL,
  `Login` varchar(255) NOT NULL,
  `Password` varchar(255) NOT NULL,
  `Email` varchar(255) NOT NULL,
  `LastIpAddress` varchar(16) NOT NULL,
  `LastLoginTime` datetime NOT NULL,
  `RegistrationTime` datetime NOT NULL,
  `Locked` int(11) NOT NULL,
  `Role` int(11) NOT NULL,
  PRIMARY KEY  (`Id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;

-- --------------------------------------------------------

--
-- Struktura tabulky `UserOnline`
--

CREATE TABLE IF NOT EXISTS `UserOnline` (
  `Id` int(11) NOT NULL auto_increment,
  `User` int(11) NOT NULL default '0',
  `ActivityTime` datetime NOT NULL default '0000-00-00 00:00:00',
  `LoginTime` datetime NOT NULL default '0000-00-00 00:00:00',
  `SessionId` varchar(255) character set utf8 collate utf8_czech_ci NOT NULL default '',
  `IpAddress` varchar(16) character set utf8 collate utf8_czech_ci NOT NULL default '',
  `HostName` varchar(255) character set utf8 collate utf8_czech_ci NOT NULL default '',
  `ScriptName` varchar(255) character set utf8 collate utf8_czech_ci NOT NULL,
  PRIMARY KEY  (`Id`),
  KEY `User` (`User`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=27 ;

--
-- Omezení pro exportované tabulky
--

--
-- Omezení pro tabulku `Database`
--
ALTER TABLE `Database`
  ADD CONSTRAINT `Database_ibfk_1` FOREIGN KEY (`Emulator`) REFERENCES `Emulator` (`Id`);

--
-- Omezení pro tabulku `Debug`
--
ALTER TABLE `Debug`
  ADD CONSTRAINT `Debug_ibfk_1` FOREIGN KEY (`Realm`) REFERENCES `Realm` (`Id`);

--
-- Omezení pro tabulku `Emulator`
--
ALTER TABLE `Emulator`
  ADD CONSTRAINT `Emulator_ibfk_1` FOREIGN KEY (`Client`) REFERENCES `Client` (`Id`);

--
-- Omezení pro tabulku `History`
--
ALTER TABLE `History`
  ADD CONSTRAINT `History_ibfk_1` FOREIGN KEY (`Server`) REFERENCES `Server` (`Id`);

--
-- Omezení pro tabulku `Log`
--
ALTER TABLE `Log`
  ADD CONSTRAINT `Log_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);

--
-- Omezení pro tabulku `News`
--
ALTER TABLE `News`
  ADD CONSTRAINT `News_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);

--
-- Omezení pro tabulku `Realm`
--
ALTER TABLE `Realm`
  ADD CONSTRAINT `Realm_ibfk_1` FOREIGN KEY (`Server`) REFERENCES `Server` (`Id`),
  ADD CONSTRAINT `Realm_ibfk_2` FOREIGN KEY (`Database`) REFERENCES `Database` (`Id`);

--
-- Omezení pro tabulku `RealmLog`
--
ALTER TABLE `RealmLog`
  ADD CONSTRAINT `RealmLog_ibfk_1` FOREIGN KEY (`Realm`) REFERENCES `Realm` (`Id`);

--
-- Omezení pro tabulku `Server`
--
ALTER TABLE `Server`
  ADD CONSTRAINT `Server_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`),
  ADD CONSTRAINT `Server_ibfk_2` FOREIGN KEY (`Database`) REFERENCES `Database` (`Id`);

--
-- Omezení pro tabulku `Task`
--
ALTER TABLE `Task`
  ADD CONSTRAINT `Task_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);

--
-- Omezení pro tabulku `UserOnline`
--
ALTER TABLE `UserOnline`
  ADD CONSTRAINT `UserOnline_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);
