diff options
Diffstat (limited to 'OpenSim/Data/Migration.cs')
-rw-r--r-- | OpenSim/Data/Migration.cs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 54d4970..d23200c 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs | |||
@@ -129,9 +129,12 @@ namespace OpenSim.Data | |||
129 | cmd.CommandText = kvp.Value; | 129 | cmd.CommandText = kvp.Value; |
130 | cmd.ExecuteNonQuery(); | 130 | cmd.ExecuteNonQuery(); |
131 | 131 | ||
132 | if (version == 0) { | 132 | if (version == 0) |
133 | { | ||
133 | InsertVersion(_type, newversion); | 134 | InsertVersion(_type, newversion); |
134 | } else { | 135 | } |
136 | else | ||
137 | { | ||
135 | UpdateVersion(_type, newversion); | 138 | UpdateVersion(_type, newversion); |
136 | } | 139 | } |
137 | version = newversion; | 140 | version = newversion; |
@@ -149,7 +152,7 @@ namespace OpenSim.Data | |||
149 | if (m.Success) | 152 | if (m.Success) |
150 | { | 153 | { |
151 | int MigrationVersion = int.Parse(m.Groups[1].ToString()); | 154 | int MigrationVersion = int.Parse(m.Groups[1].ToString()); |
152 | if ( MigrationVersion > max ) | 155 | if (MigrationVersion > max) |
153 | max = MigrationVersion; | 156 | max = MigrationVersion; |
154 | } | 157 | } |
155 | } | 158 | } |
@@ -160,9 +163,12 @@ namespace OpenSim.Data | |||
160 | { | 163 | { |
161 | get { return FindVersion(_type); } | 164 | get { return FindVersion(_type); } |
162 | set { | 165 | set { |
163 | if (Version < 1) { | 166 | if (Version < 1) |
167 | { | ||
164 | InsertVersion(_type, value); | 168 | InsertVersion(_type, value); |
165 | } else { | 169 | } |
170 | else | ||
171 | { | ||
166 | UpdateVersion(_type, value); | 172 | UpdateVersion(_type, value); |
167 | } | 173 | } |
168 | } | 174 | } |
@@ -172,7 +178,8 @@ namespace OpenSim.Data | |||
172 | { | 178 | { |
173 | int version = 0; | 179 | int version = 0; |
174 | DbCommand cmd = _conn.CreateCommand(); | 180 | DbCommand cmd = _conn.CreateCommand(); |
175 | try { | 181 | try |
182 | { | ||
176 | cmd.CommandText = "select version from migrations where name='" + type + "' limit 1"; | 183 | cmd.CommandText = "select version from migrations where name='" + type + "' limit 1"; |
177 | using (IDataReader reader = cmd.ExecuteReader()) | 184 | using (IDataReader reader = cmd.ExecuteReader()) |
178 | { | 185 | { |
@@ -182,7 +189,9 @@ namespace OpenSim.Data | |||
182 | } | 189 | } |
183 | reader.Close(); | 190 | reader.Close(); |
184 | } | 191 | } |
185 | } catch { | 192 | } |
193 | catch | ||
194 | { | ||
186 | // Something went wrong, so we're version 0 | 195 | // Something went wrong, so we're version 0 |
187 | } | 196 | } |
188 | return version; | 197 | return version; |