aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJohan Berntsson2008-03-07 08:10:52 +0000
committerJohan Berntsson2008-03-07 08:10:52 +0000
commitb99455d23d57d10c221929a9233520026aed2cd4 (patch)
tree681bea0b0dfcaf3c13c6d86afe9f7862138eca77 /OpenSim
parent* Fix for exception in landmanager crash. (diff)
downloadopensim-SC-b99455d23d57d10c221929a9233520026aed2cd4.zip
opensim-SC-b99455d23d57d10c221929a9233520026aed2cd4.tar.gz
opensim-SC-b99455d23d57d10c221929a9233520026aed2cd4.tar.bz2
opensim-SC-b99455d23d57d10c221929a9233520026aed2cd4.tar.xz
Fix to solve mantis 717 problem. Makes sure the region DB schema is up to date and consistent
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs7
-rw-r--r--OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql3
-rw-r--r--OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion3.sql18
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs19
4 files changed, 36 insertions, 11 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index eefb4e9..0ae8e0b 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -97,11 +97,16 @@ namespace OpenSim.Framework.Data.MySQL
97 database.ExecuteResourceSql("CreateRegionsTable.sql"); 97 database.ExecuteResourceSql("CreateRegionsTable.sql");
98 return; 98 return;
99 } 99 }
100 else if (oldVersion.Contains("Rev. 1")) 100 if (oldVersion.Contains("Rev. 1"))
101 { 101 {
102 database.ExecuteResourceSql("UpgradeRegionsTableToVersion2.sql"); 102 database.ExecuteResourceSql("UpgradeRegionsTableToVersion2.sql");
103 return; 103 return;
104 } 104 }
105 if (oldVersion.Contains("Rev. 2"))
106 {
107 database.ExecuteResourceSql("UpgradeRegionsTableToVersion3.sql");
108 return;
109 }
105 } 110 }
106 111
107 #endregion 112 #endregion
diff --git a/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql b/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql
index 23535af..cb0f9bd 100644
--- a/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql
+++ b/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql
@@ -23,9 +23,10 @@ CREATE TABLE `regions` (
23 `regionUserRecvKey` varchar(128) default NULL, 23 `regionUserRecvKey` varchar(128) default NULL,
24 `regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL, 24 `regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL,
25 `serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL, 25 `serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL,
26 `owner_uuid` varchar(36) default '00000000-0000-0000-0000-000000000000' not null,
26 `originUUID` varchar(36), 27 `originUUID` varchar(36),
27 PRIMARY KEY (`uuid`), 28 PRIMARY KEY (`uuid`),
28 KEY `regionName` (`regionName`), 29 KEY `regionName` (`regionName`),
29 KEY `regionHandle` (`regionHandle`), 30 KEY `regionHandle` (`regionHandle`),
30 KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`) 31 KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`)
31) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 2'; 32) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 3';
diff --git a/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion3.sql b/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion3.sql
new file mode 100644
index 0000000..b48afec
--- /dev/null
+++ b/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion3.sql
@@ -0,0 +1,18 @@
1DROP PROCEDURE IF EXISTS upgraderegions3;
2
3create procedure upgraderegions3()
4BEGIN
5DECLARE db_name varchar(64);
6select database() into db_name;
7IF ((select count(*) from information_schema.columns where table_name='regions' and column_name='owner_uuid' and table_schema=db_name) > 0)
8THEN
9 ALTER TABLE `regions`, COMMENT='Rev. 3';
10ELSE
11 ALTER TABLE `regions`
12 ADD COLUMN `owner_uuid` varchar(36) default '00000000-0000-0000-0000-000000000000' not null after serverRemotingPort, COMMENT='Rev. 3';
13END IF;
14END;
15
16call upgraderegions3();
17
18
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 2c9e50e..ea25147 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -470,20 +470,21 @@ namespace OpenSim
470 public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag) 470 public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag)
471 { 471 {
472 int port = regionInfo.InternalEndPoint.Port; 472 int port = regionInfo.InternalEndPoint.Port;
473 if ((proxyOffset != 0) && (portadd_flag))
474 {
475 // set proxy url to RegionInfo
476 regionInfo.proxyUrl = proxyUrl;
477 473
478 // set initial RegionID to originRegionID in RegionInfo. (it needs for loding prims) 474 // set initial RegionID to originRegionID in RegionInfo. (it needs for loding prims)
479 regionInfo.originRegionID = regionInfo.RegionID; 475 regionInfo.originRegionID = regionInfo.RegionID;
480 476
481 // set initial ServerURI 477 // set initial ServerURI
482 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName 478 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName
483 + ":" + regionInfo.InternalEndPoint.Port.ToString(); 479 + ":" + regionInfo.InternalEndPoint.Port.ToString();
484 480
481 if ((proxyUrl.Length > 0) && (portadd_flag))
482 {
483 // set proxy url to RegionInfo
484 regionInfo.proxyUrl = proxyUrl;
485 ProxyCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); 485 ProxyCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
486 } 486 }
487
487 UDPServer udpServer; 488 UDPServer udpServer;
488 Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions); 489 Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions);
489 490