source: trunk/www/SQL/Updates/69.sql

Last change on this file was 94, checked in by chronos, 11 years ago
File size: 1.3 KB
Line 
1CREATE 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
7INSERT INTO `ClusterNode` (`Id` ,`NetworkAddress`) VALUES ( NULL , 'localhost' );
8
9
10ALTER TABLE `Realm` ADD `ClusterNode` INT NOT NULL ;
11ALTER TABLE `Realm` ADD INDEX ( `ClusterNode` ) ;
12UPDATE `Realm` SET `ClusterNode` = 1;
13ALTER TABLE `Realm` ADD FOREIGN KEY ( `ClusterNode` ) REFERENCES `ClusterNode` (`Id`);
14
15
16ALTER TABLE `Server` ADD `ClusterNode` INT NOT NULL ;
17ALTER TABLE `Server` ADD INDEX ( `ClusterNode` ) ;
18UPDATE `Server` SET `ClusterNode` = 1;
19ALTER TABLE `Server` ADD FOREIGN KEY ( `ClusterNode` ) REFERENCES `ClusterNode` ( `Id` );
20
21
22CREATE 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
34ALTER 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`);
Note: See TracBrowser for help on using the repository browser.