1 | CREATE TABLE IF NOT EXISTS `ClusterNode` (
|
---|
2 | `Id` int(11) NOT NULL auto_increment,
|
---|
3 | `NetworkAddress` VARCHAR(255) NOT NULL,
|
---|
4 | PRIMARY KEY (`Id`)
|
---|
5 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
---|
6 |
|
---|
7 | INSERT INTO `ClusterNode` (`Id` ,`NetworkAddress`) VALUES ( NULL , 'localhost' );
|
---|
8 |
|
---|
9 |
|
---|
10 | ALTER TABLE `Realm` ADD `ClusterNode` INT NOT NULL ;
|
---|
11 | ALTER TABLE `Realm` ADD INDEX ( `ClusterNode` ) ;
|
---|
12 | UPDATE `Realm` SET `ClusterNode` = 1;
|
---|
13 | ALTER TABLE `Realm` ADD FOREIGN KEY ( `ClusterNode` ) REFERENCES `ClusterNode` (`Id`);
|
---|
14 |
|
---|
15 |
|
---|
16 | ALTER TABLE `Server` ADD `ClusterNode` INT NOT NULL ;
|
---|
17 | ALTER TABLE `Server` ADD INDEX ( `ClusterNode` ) ;
|
---|
18 | UPDATE `Server` SET `ClusterNode` = 1;
|
---|
19 | ALTER TABLE `Server` ADD FOREIGN KEY ( `ClusterNode` ) REFERENCES `ClusterNode` ( `Id` );
|
---|
20 |
|
---|
21 |
|
---|
22 | CREATE TABLE IF NOT EXISTS `CustomPatch` (
|
---|
23 | `Id` int(11) NOT NULL auto_increment,
|
---|
24 | `Type` int(11) NOT NULL,
|
---|
25 | `User` int(11) NOT NULL,
|
---|
26 | `TimeCreate` datetime NOT NULL,
|
---|
27 | `Realm` int(11) NOT NULL,
|
---|
28 | `Content` mediumtext NOT NULL,
|
---|
29 | PRIMARY KEY (`Id`),
|
---|
30 | KEY `Realm` (`Realm`),
|
---|
31 | KEY `User` (`User`)
|
---|
32 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
---|
33 |
|
---|
34 | ALTER TABLE `CustomPatch`
|
---|
35 | ADD CONSTRAINT `CustomPatch_ibfk_2` FOREIGN KEY (`User`) REFERENCES `User` (`Id`),
|
---|
36 | ADD CONSTRAINT `CustomPatch_ibfk_1` FOREIGN KEY (`Realm`) REFERENCES `Realm` (`Id`);
|
---|