aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs34
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs51
-rw-r--r--OpenSim/Framework/Data.MySQL/Resources/CreateAgentsTable.sql24
-rw-r--r--OpenSim/Framework/Data.MySQL/Resources/CreateLogsTable.sql10
-rw-r--r--OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql30
-rw-r--r--OpenSim/Framework/Data.MySQL/Resources/CreateUsersTable.sql34
6 files changed, 183 insertions, 0 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index bb0e8b3..ac3d849 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -62,8 +62,42 @@ namespace OpenSim.Framework.Data.MySQL
62 database = 62 database =
63 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, 63 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
64 settingPort); 64 settingPort);
65
66 TestTables();
65 } 67 }
66 68
69 #region Test and initialization code
70
71 /// <summary>
72 /// Ensure that the user related tables exists and are at the latest version
73 /// </summary>
74 private void TestTables()
75 {
76 Dictionary<string, string> tableList = new Dictionary<string, string>();
77
78 tableList["regions"] = null;
79 database.GetTableVersion(tableList);
80
81 UpgradeRegionsTable(tableList["regions"]);
82 }
83
84 /// <summary>
85 /// Create or upgrade the table if necessary
86 /// </summary>
87 /// <param name="oldVersion">A null indicates that the table does not
88 /// currently exist</param>
89 private void UpgradeRegionsTable(string oldVersion)
90 {
91 // null as the version, indicates that the table didn't exist
92 if (oldVersion == null)
93 {
94 database.ExecuteResourceSql("CreateRegionsTable.sql");
95 return;
96 }
97 }
98
99 #endregion
100
67 /// <summary> 101 /// <summary>
68 /// Shuts down the grid interface 102 /// Shuts down the grid interface
69 /// </summary> 103 /// </summary>
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index 9c97a6a..c21f899 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -61,8 +61,59 @@ namespace OpenSim.Framework.Data.MySQL
61 database = 61 database =
62 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, 62 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
63 settingPort); 63 settingPort);
64
65 TestTables();
64 } 66 }
65 67
68 #region Test and initialization code
69
70 /// <summary>
71 /// Ensure that the user related tables exists and are at the latest version
72 /// </summary>
73 private void TestTables()
74 {
75 Dictionary<string, string> tableList = new Dictionary<string, string>();
76
77 tableList["agents"] = null;
78 tableList["users"] = null;
79 database.GetTableVersion(tableList);
80
81 UpgradeAgentsTable(tableList["agents"]);
82 UpgradeUsersTable(tableList["users"]);
83 }
84
85 /// <summary>
86 /// Create or upgrade the table if necessary
87 /// </summary>
88 /// <param name="oldVersion">A null indicates that the table does not
89 /// currently exist</param>
90 private void UpgradeAgentsTable(string oldVersion)
91 {
92 // null as the version, indicates that the table didn't exist
93 if (oldVersion == null)
94 {
95 database.ExecuteResourceSql("CreateAgentsTable.sql");
96 return;
97 }
98 }
99
100 /// <summary>
101 /// Create or upgrade the table if necessary
102 /// </summary>
103 /// <param name="oldVersion">A null indicates that the table does not
104 /// currently exist</param>
105 private void UpgradeUsersTable(string oldVersion)
106 {
107 // null as the version, indicates that the table didn't exist
108 if (oldVersion == null)
109 {
110 database.ExecuteResourceSql("CreateUsersTable.sql");
111 return;
112 }
113 }
114
115 #endregion
116
66 /// <summary> 117 /// <summary>
67 /// Searches the database for a specified user profile 118 /// Searches the database for a specified user profile
68 /// </summary> 119 /// </summary>
diff --git a/OpenSim/Framework/Data.MySQL/Resources/CreateAgentsTable.sql b/OpenSim/Framework/Data.MySQL/Resources/CreateAgentsTable.sql
new file mode 100644
index 0000000..3ef7bc9
--- /dev/null
+++ b/OpenSim/Framework/Data.MySQL/Resources/CreateAgentsTable.sql
@@ -0,0 +1,24 @@
1SET FOREIGN_KEY_CHECKS=0;
2-- ----------------------------
3-- Table structure for agents
4-- ----------------------------
5CREATE TABLE `agents` (
6 `UUID` varchar(36) NOT NULL,
7 `sessionID` varchar(36) NOT NULL,
8 `secureSessionID` varchar(36) NOT NULL,
9 `agentIP` varchar(16) NOT NULL,
10 `agentPort` int(11) NOT NULL,
11 `agentOnline` tinyint(4) NOT NULL,
12 `loginTime` int(11) NOT NULL,
13 `logoutTime` int(11) NOT NULL,
14 `currentRegion` varchar(36) NOT NULL,
15 `currentHandle` bigint(20) unsigned NOT NULL,
16 `currentPos` varchar(64) NOT NULL,
17 PRIMARY KEY (`UUID`),
18 UNIQUE KEY `session` (`sessionID`),
19 UNIQUE KEY `ssession` (`secureSessionID`)
20) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
21
22-- ----------------------------
23-- Records
24-- ----------------------------
diff --git a/OpenSim/Framework/Data.MySQL/Resources/CreateLogsTable.sql b/OpenSim/Framework/Data.MySQL/Resources/CreateLogsTable.sql
new file mode 100644
index 0000000..64b3a80
--- /dev/null
+++ b/OpenSim/Framework/Data.MySQL/Resources/CreateLogsTable.sql
@@ -0,0 +1,10 @@
1CREATE TABLE `logs` (
2 `logID` int(10) unsigned NOT NULL auto_increment,
3 `target` varchar(36) default NULL,
4 `server` varchar(64) default NULL,
5 `method` varchar(64) default NULL,
6 `arguments` varchar(255) default NULL,
7 `priority` int(11) default NULL,
8 `message` text,
9 PRIMARY KEY (`logID`)
10) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
diff --git a/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql b/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql
new file mode 100644
index 0000000..07b0d9b
--- /dev/null
+++ b/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql
@@ -0,0 +1,30 @@
1CREATE 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 PRIMARY KEY (`uuid`),
27 KEY `regionName` (`regionName`),
28 KEY `regionHandle` (`regionHandle`),
29 KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`)
30) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 1';
diff --git a/OpenSim/Framework/Data.MySQL/Resources/CreateUsersTable.sql b/OpenSim/Framework/Data.MySQL/Resources/CreateUsersTable.sql
new file mode 100644
index 0000000..faac541
--- /dev/null
+++ b/OpenSim/Framework/Data.MySQL/Resources/CreateUsersTable.sql
@@ -0,0 +1,34 @@
1SET FOREIGN_KEY_CHECKS=0;
2-- ----------------------------
3-- Table structure for users
4-- ----------------------------
5CREATE TABLE `users` (
6 `UUID` varchar(36) NOT NULL default '',
7 `username` varchar(32) NOT NULL,
8 `lastname` varchar(32) NOT NULL,
9 `passwordHash` varchar(32) NOT NULL,
10 `passwordSalt` varchar(32) NOT NULL,
11 `homeRegion` bigint(20) unsigned default NULL,
12 `homeLocationX` float default NULL,
13 `homeLocationY` float default NULL,
14 `homeLocationZ` float default NULL,
15 `homeLookAtX` float default NULL,
16 `homeLookAtY` float default NULL,
17 `homeLookAtZ` float default NULL,
18 `created` int(11) NOT NULL,
19 `lastLogin` int(11) NOT NULL,
20 `userInventoryURI` varchar(255) default NULL,
21 `userAssetURI` varchar(255) default NULL,
22 `profileCanDoMask` int(10) unsigned default NULL,
23 `profileWantDoMask` int(10) unsigned default NULL,
24 `profileAboutText` text,
25 `profileFirstText` text,
26 `profileImage` varchar(36) default NULL,
27 `profileFirstImage` varchar(36) default NULL,
28 PRIMARY KEY (`UUID`),
29 UNIQUE KEY `usernames` (`username`,`lastname`)
30) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
31
32-- ----------------------------
33-- Records
34-- ----------------------------