From b99455d23d57d10c221929a9233520026aed2cd4 Mon Sep 17 00:00:00 2001
From: Johan Berntsson
Date: Fri, 7 Mar 2008 08:10:52 +0000
Subject: Fix to solve mantis 717 problem. Makes sure the region DB schema is
 up to date and consistent

---
 .../Resources/UpgradeRegionsTableToVersion3.sql        | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion3.sql

(limited to 'OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion3.sql')

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 @@
+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();
+
+
-- 
cgit v1.1

