source: trunk/sql/updates/650.sql

Last change on this file was 712, checked in by chronos, 11 years ago
  • Upraveno: Aktualizace inicializačního skriptu pro sql databázi na revizi 710.
  • Upraveno: Aktualizována třída Database na novější využívající třídu PDO a generující výjímky při chybě, které je pak nutno očetřit.
File size: 3.2 KB
Line 
1ALTER TABLE `GmTeam` ADD INDEX ( `TimeFrom` ) ;
2ALTER TABLE `GmTeam` ADD INDEX ( `TimeTo` ) ;
3ALTER TABLE `GmTeam` ADD INDEX ( `RealmId` ) ;
4
5DROP TABLE `achievement` ,
6`chyby` ,
7`diskuze` ,
8`export_list` ,
9`uzivatele` ;
10
11CREATE TABLE IF NOT EXISTS `Realm` (
12 `Id` int(11) NOT NULL auto_increment,
13 `Host` int(11) NOT NULL,
14 `Logon` int(11) NOT NULL,
15 `DatabaseHost` varchar(255) NOT NULL,
16 `DatabaseUser` varchar(255) NOT NULL,
17 `DatabasePassword` varchar(255) NOT NULL,
18 `DatabaseCharacters` varchar(255) NOT NULL,
19 `DatabaseMangos` varchar(255) NOT NULL,
20 `DatabaseScriptDev2` varchar(255) NOT NULL,
21 `MaxOnlinePlayers` int(11) NOT NULL,
22 `Rate` int(11) NOT NULL,
23 `Type` varchar(255) NOT NULL,
24 `Name` varchar(255) NOT NULL,
25 `Description` text NOT NULL,
26 PRIMARY KEY (`Id`)
27) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
28
29CREATE TABLE IF NOT EXISTS `Logon` (
30 `Id` int(11) NOT NULL auto_increment,
31 `Host` int(11) NOT NULL,
32 `DatabaseUser` varchar(255) NOT NULL,
33 `DatabasePassword` varchar(255) NOT NULL,
34 `DatabaseHost` varchar(255) NOT NULL,
35 `DatabaseRealmd` varchar(255) NOT NULL,
36 `ClientVersion` varchar(255) NOT NULL,
37 PRIMARY KEY (`Id`)
38) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
39
40
41CREATE TABLE IF NOT EXISTS `Host` (
42 `Id` int(11) NOT NULL auto_increment,
43 `OS` varchar(255) NOT NULL,
44 `CPU` varchar(255) NOT NULL,
45 `Memory` varchar(255) NOT NULL,
46 `HDD` varchar(255) NOT NULL,
47 `Internet` varchar(255) NOT NULL,
48 `Address` varchar(255) NOT NULL,
49 `Statistic` varchar(255) NOT NULL,
50 PRIMARY KEY (`Id`)
51) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
52
53ALTER TABLE `Logon` ADD INDEX ( `Host` ) ;
54ALTER TABLE `Logon` ADD FOREIGN KEY ( `Host` ) REFERENCES `Host` (`Id`);
55
56ALTER TABLE `Realm` ADD INDEX ( `Host` ) ;
57ALTER TABLE `Realm` ADD INDEX ( `Logon` ) ;
58
59ALTER TABLE `Realm` ADD FOREIGN KEY ( `Host` ) REFERENCES `Host` (`Id`);
60ALTER TABLE `Realm` ADD FOREIGN KEY ( `Logon` ) REFERENCES `Logon` (`Id`);
61
62ALTER TABLE `Article` ADD INDEX ( `Time` ) ;
63
64ALTER TABLE `Realm` ADD `Online` INT NOT NULL DEFAULT '0';
65ALTER TABLE `Logon` ADD `Port` INT NOT NULL ;
66
67ALTER TABLE `articles` CHANGE `id` `Id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
68CHANGE `title` `Title` TEXT CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL ,
69CHANGE `autor` `Author` TEXT CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL ,
70CHANGE `category` `Category` INT( 11 ) NOT NULL DEFAULT '0',
71CHANGE `text` `Content` TEXT CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL ,
72CHANGE `date` `Time` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00';
73
74RENAME TABLE `articles` TO `Article` ;
75ALTER TABLE `Article` ENGINE = InnoDB;
76
77ALTER TABLE `Article` ADD INDEX ( `Category` ) ;
78
79CREATE TABLE IF NOT EXISTS `ArticleCategory` (
80 `Id` int(11) NOT NULL auto_increment,
81 `Name` varchar(255) NOT NULL,
82 PRIMARY KEY (`Id`)
83) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
84
85INSERT INTO `ArticleCategory` (`Id`, `Name`) VALUES
86(1, 'Server novinky'),
87(2, 'GM novinky'),
88(3, 'In-game novinky'),
89(4, 'Články');
90
91ALTER TABLE `Article` ADD FOREIGN KEY ( `Category` ) REFERENCES `ArticleCategory` (`Id`);
92
Note: See TracBrowser for help on using the repository browser.