diff options
author | Sean Dague | 2008-06-19 15:42:57 +0000 |
---|---|---|
committer | Sean Dague | 2008-06-19 15:42:57 +0000 |
commit | d28a5a4de78f79d2730d09d20a8284caef5339bf (patch) | |
tree | bb8591c996283ffa6127ce2896771a75ac017fa9 /OpenSim | |
parent | fix an edge case with migrations in the region store. (diff) | |
download | opensim-SC-d28a5a4de78f79d2730d09d20a8284caef5339bf.zip opensim-SC-d28a5a4de78f79d2730d09d20a8284caef5339bf.tar.gz opensim-SC-d28a5a4de78f79d2730d09d20a8284caef5339bf.tar.bz2 opensim-SC-d28a5a4de78f79d2730d09d20a8284caef5339bf.tar.xz |
add migrations support for mysql log store. This should complete
all the mysql bits for migration.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLLogData.cs | 30 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/001_LogStore.sql | 10 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/CreateLogsTable.sql | 2 |
3 files changed, 41 insertions, 1 deletions
diff --git a/OpenSim/Data/MySQL/MySQLLogData.cs b/OpenSim/Data/MySQL/MySQLLogData.cs index 2bd246a..2e6de7c 100644 --- a/OpenSim/Data/MySQL/MySQLLogData.cs +++ b/OpenSim/Data/MySQL/MySQLLogData.cs | |||
@@ -65,6 +65,36 @@ namespace OpenSim.Data.MySQL | |||
65 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, | 65 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, |
66 | settingPooling, settingPort); | 66 | settingPooling, settingPort); |
67 | } | 67 | } |
68 | |||
69 | // This actually does the roll forward assembly stuff | ||
70 | Assembly assem = GetType().Assembly; | ||
71 | Migration m = new Migration(database.Connection, assem, "LogStore"); | ||
72 | |||
73 | // TODO: After rev 6000, remove this. People should have | ||
74 | // been rolled onto the new migration code by then. | ||
75 | TestTables(m); | ||
76 | |||
77 | m.Update(); | ||
78 | |||
79 | } | ||
80 | |||
81 | private void TestTables(Migration m) | ||
82 | { | ||
83 | // under migrations, bail | ||
84 | if (m.Version > 0) | ||
85 | return; | ||
86 | |||
87 | Dictionary<string, string> tableList = new Dictionary<string, string>(); | ||
88 | tableList["logs"] = null; | ||
89 | database.GetTableVersion(tableList); | ||
90 | |||
91 | // migrations will handle it | ||
92 | if (tableList["logs"] == null) | ||
93 | return; | ||
94 | |||
95 | // we have the table, so pretend like we did the first migration in the past | ||
96 | if (m.Version == 0) | ||
97 | m.Version = 1; | ||
68 | } | 98 | } |
69 | 99 | ||
70 | /// <summary> | 100 | /// <summary> |
diff --git a/OpenSim/Data/MySQL/Resources/001_LogStore.sql b/OpenSim/Data/MySQL/Resources/001_LogStore.sql new file mode 100644 index 0000000..b4c29fb --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/001_LogStore.sql | |||
@@ -0,0 +1,10 @@ | |||
1 | CREATE 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; | ||
diff --git a/OpenSim/Data/MySQL/Resources/CreateLogsTable.sql b/OpenSim/Data/MySQL/Resources/CreateLogsTable.sql index 64b3a80..53dcd31 100644 --- a/OpenSim/Data/MySQL/Resources/CreateLogsTable.sql +++ b/OpenSim/Data/MySQL/Resources/CreateLogsTable.sql | |||
@@ -7,4 +7,4 @@ CREATE TABLE `logs` ( | |||
7 | `priority` int(11) default NULL, | 7 | `priority` int(11) default NULL, |
8 | `message` text, | 8 | `message` text, |
9 | PRIMARY KEY (`logID`) | 9 | PRIMARY KEY (`logID`) |
10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; | 10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 |