1 | CREATE TABLE IF NOT EXISTS `Realm` (
|
---|
2 | `Id` int(11) NOT NULL auto_increment,
|
---|
3 | `Name` varchar(255) NOT NULL,
|
---|
4 | `Database` int(11) NOT NULL,
|
---|
5 | `Server` int(11) NOT NULL,
|
---|
6 | `NetworkPortWorldd` int(11) NOT NULL,
|
---|
7 | `Motd` varchar(255) NOT NULL,
|
---|
8 | `Description` text NOT NULL,
|
---|
9 | `Type` int(11) NOT NULL,
|
---|
10 | `Homepage` varchar(255) NOT NULL,
|
---|
11 | `TimeCreate` datetime NOT NULL,
|
---|
12 | `Online` int(11) NOT NULL,
|
---|
13 | `CharacterOnlineCount` int(11) NOT NULL,
|
---|
14 | `CharacterCount` int(11) NOT NULL,
|
---|
15 | `AccountCount` int(11) NOT NULL,
|
---|
16 | `Lock` int(11) NOT NULL,
|
---|
17 | PRIMARY KEY (`Id`),
|
---|
18 | KEY `Database` (`Database`),
|
---|
19 | KEY `Server` (`Server`)
|
---|
20 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
---|
21 |
|
---|
22 | ALTER TABLE `Realm`
|
---|
23 | ADD CONSTRAINT `Realm_ibfk_1` FOREIGN KEY (`Server`) REFERENCES `Server` (`Id`);
|
---|
24 | ALTER TABLE `Realm` ADD FOREIGN KEY ( `Database` ) REFERENCES `Database` (`Id`);
|
---|
25 |
|
---|
26 | INSERT INTO `Realm` (SELECT 0 AS `Id`, "" AS `Name`, `Server`.`Database` AS `Database`, `Server`.`Id` AS `Server`, `NetworkPortWorldd`, `Motd`, "" AS `Description`, `Type`, "" AS `Homepage`, `TimeCreate`, 0 AS `Online`, `CharacterOnlineCount`, `CharacterCount`, `AccountCount`, 0 AS `Lock` FROM `Server`);
|
---|
27 |
|
---|
28 | ALTER TABLE `Server` DROP `NetworkPortWorldd` , DROP `Motd` , DROP `Type` ;
|
---|