diff options
-rw-r--r-- | OpenSim/Data/MySQL/MySQLDataStore.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGridData.cs | 20 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/001_GridStore.sql | 32 |
3 files changed, 54 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLDataStore.cs b/OpenSim/Data/MySQL/MySQLDataStore.cs index 01cd605..ff1b583 100644 --- a/OpenSim/Data/MySQL/MySQLDataStore.cs +++ b/OpenSim/Data/MySQL/MySQLDataStore.cs | |||
@@ -1670,6 +1670,10 @@ namespace OpenSim.Data.MySQL | |||
1670 | 1670 | ||
1671 | private bool TestTables(MySqlConnection conn, Migration m) | 1671 | private bool TestTables(MySqlConnection conn, Migration m) |
1672 | { | 1672 | { |
1673 | // we already have migrations, get out of here | ||
1674 | if (m.Version > 0) | ||
1675 | return false; | ||
1676 | |||
1673 | MySqlCommand primSelectCmd = new MySqlCommand(m_primSelect, conn); | 1677 | MySqlCommand primSelectCmd = new MySqlCommand(m_primSelect, conn); |
1674 | MySqlDataAdapter pDa = new MySqlDataAdapter(primSelectCmd); | 1678 | MySqlDataAdapter pDa = new MySqlDataAdapter(primSelectCmd); |
1675 | MySqlCommand shapeSelectCmd = new MySqlCommand(m_shapeSelect, conn); | 1679 | MySqlCommand shapeSelectCmd = new MySqlCommand(m_shapeSelect, conn); |
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs index 86ceffc..e5940e2 100644 --- a/OpenSim/Data/MySQL/MySQLGridData.cs +++ b/OpenSim/Data/MySQL/MySQLGridData.cs | |||
@@ -72,7 +72,15 @@ namespace OpenSim.Data.MySQL | |||
72 | settingPooling, settingPort); | 72 | settingPooling, settingPort); |
73 | } | 73 | } |
74 | 74 | ||
75 | TestTables(); | 75 | // This actually does the roll forward assembly stuff |
76 | Assembly assem = GetType().Assembly; | ||
77 | Migration m = new Migration(database.Connection, assem, "GridStore"); | ||
78 | |||
79 | // TODO: After rev 6000, remove this. People should have | ||
80 | // been rolled onto the new migration code by then. | ||
81 | TestTables(m); | ||
82 | |||
83 | m.Update(); | ||
76 | } | 84 | } |
77 | 85 | ||
78 | #region Test and initialization code | 86 | #region Test and initialization code |
@@ -80,14 +88,22 @@ namespace OpenSim.Data.MySQL | |||
80 | /// <summary> | 88 | /// <summary> |
81 | /// Ensure that the user related tables exists and are at the latest version | 89 | /// Ensure that the user related tables exists and are at the latest version |
82 | /// </summary> | 90 | /// </summary> |
83 | private void TestTables() | 91 | private void TestTables(Migration m) |
84 | { | 92 | { |
93 | // we already have migrations, get out of here | ||
94 | if (m.Version > 0) | ||
95 | return; | ||
96 | |||
85 | Dictionary<string, string> tableList = new Dictionary<string, string>(); | 97 | Dictionary<string, string> tableList = new Dictionary<string, string>(); |
86 | 98 | ||
87 | tableList["regions"] = null; | 99 | tableList["regions"] = null; |
88 | database.GetTableVersion(tableList); | 100 | database.GetTableVersion(tableList); |
89 | 101 | ||
90 | UpgradeRegionsTable(tableList["regions"]); | 102 | UpgradeRegionsTable(tableList["regions"]); |
103 | |||
104 | // we have tables, but not a migration model yet | ||
105 | if (m.Version == 0) | ||
106 | m.Version = 1; | ||
91 | } | 107 | } |
92 | 108 | ||
93 | /// <summary> | 109 | /// <summary> |
diff --git a/OpenSim/Data/MySQL/Resources/001_GridStore.sql b/OpenSim/Data/MySQL/Resources/001_GridStore.sql new file mode 100644 index 0000000..cb0f9bd --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/001_GridStore.sql | |||
@@ -0,0 +1,32 @@ | |||
1 | CREATE TABLE `regions` ( | ||
2 | `uuid` varchar(36) NOT NULL, | ||
3 | `regionHandle` bigint(20) unsigned NOT NULL, | ||
4 | `regionName` varchar(32) default NULL, | ||
5 | `regionRecvKey` varchar(128) default NULL, | ||
6 | `regionSendKey` varchar(128) default NULL, | ||
7 | `regionSecret` varchar(128) default NULL, | ||
8 | `regionDataURI` varchar(255) default NULL, | ||
9 | `serverIP` varchar(64) default NULL, | ||
10 | `serverPort` int(10) unsigned default NULL, | ||
11 | `serverURI` varchar(255) default NULL, | ||
12 | `locX` int(10) unsigned default NULL, | ||
13 | `locY` int(10) unsigned default NULL, | ||
14 | `locZ` int(10) unsigned default NULL, | ||
15 | `eastOverrideHandle` bigint(20) unsigned default NULL, | ||
16 | `westOverrideHandle` bigint(20) unsigned default NULL, | ||
17 | `southOverrideHandle` bigint(20) unsigned default NULL, | ||
18 | `northOverrideHandle` bigint(20) unsigned default NULL, | ||
19 | `regionAssetURI` varchar(255) default NULL, | ||
20 | `regionAssetRecvKey` varchar(128) default NULL, | ||
21 | `regionAssetSendKey` varchar(128) default NULL, | ||
22 | `regionUserURI` varchar(255) default NULL, | ||
23 | `regionUserRecvKey` varchar(128) default NULL, | ||
24 | `regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) 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, | ||
27 | `originUUID` varchar(36), | ||
28 | PRIMARY KEY (`uuid`), | ||
29 | KEY `regionName` (`regionName`), | ||
30 | KEY `regionHandle` (`regionHandle`), | ||
31 | KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`) | ||
32 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 3'; | ||