Fix to solve mantis 717 problem. Makes sure the region DB schema is up to date and consistent

0.6.0-stable
Johan Berntsson 2008-03-07 08:10:52 +00:00
parent c9eb051936
commit b99455d23d
4 changed files with 36 additions and 11 deletions

View File

@ -97,11 +97,16 @@ namespace OpenSim.Framework.Data.MySQL
database.ExecuteResourceSql("CreateRegionsTable.sql"); database.ExecuteResourceSql("CreateRegionsTable.sql");
return; return;
} }
else if (oldVersion.Contains("Rev. 1")) if (oldVersion.Contains("Rev. 1"))
{ {
database.ExecuteResourceSql("UpgradeRegionsTableToVersion2.sql"); database.ExecuteResourceSql("UpgradeRegionsTableToVersion2.sql");
return; return;
} }
if (oldVersion.Contains("Rev. 2"))
{
database.ExecuteResourceSql("UpgradeRegionsTableToVersion3.sql");
return;
}
} }
#endregion #endregion

View File

@ -23,9 +23,10 @@ CREATE TABLE `regions` (
`regionUserRecvKey` varchar(128) default NULL, `regionUserRecvKey` varchar(128) default NULL,
`regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL, `regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL,
`serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL, `serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL,
`owner_uuid` varchar(36) default '00000000-0000-0000-0000-000000000000' not null,
`originUUID` varchar(36), `originUUID` varchar(36),
PRIMARY KEY (`uuid`), PRIMARY KEY (`uuid`),
KEY `regionName` (`regionName`), KEY `regionName` (`regionName`),
KEY `regionHandle` (`regionHandle`), KEY `regionHandle` (`regionHandle`),
KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`) KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 2'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 3';

View File

@ -0,0 +1,18 @@
DROP PROCEDURE IF EXISTS upgraderegions3;
create procedure upgraderegions3()
BEGIN
DECLARE db_name varchar(64);
select database() into db_name;
IF ((select count(*) from information_schema.columns where table_name='regions' and column_name='owner_uuid' and table_schema=db_name) > 0)
THEN
ALTER TABLE `regions`, COMMENT='Rev. 3';
ELSE
ALTER TABLE `regions`
ADD COLUMN `owner_uuid` varchar(36) default '00000000-0000-0000-0000-000000000000' not null after serverRemotingPort, COMMENT='Rev. 3';
END IF;
END;
call upgraderegions3();

View File

@ -470,10 +470,6 @@ namespace OpenSim
public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag) public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag)
{ {
int port = regionInfo.InternalEndPoint.Port; int port = regionInfo.InternalEndPoint.Port;
if ((proxyOffset != 0) && (portadd_flag))
{
// set proxy url to RegionInfo
regionInfo.proxyUrl = proxyUrl;
// set initial RegionID to originRegionID in RegionInfo. (it needs for loding prims) // set initial RegionID to originRegionID in RegionInfo. (it needs for loding prims)
regionInfo.originRegionID = regionInfo.RegionID; regionInfo.originRegionID = regionInfo.RegionID;
@ -482,8 +478,13 @@ namespace OpenSim
regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName
+ ":" + regionInfo.InternalEndPoint.Port.ToString(); + ":" + regionInfo.InternalEndPoint.Port.ToString();
if ((proxyUrl.Length > 0) && (portadd_flag))
{
// set proxy url to RegionInfo
regionInfo.proxyUrl = proxyUrl;
ProxyCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); ProxyCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
} }
UDPServer udpServer; UDPServer udpServer;
Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions); Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions);