diff options
author | Sean Dague | 2008-06-11 21:01:33 +0000 |
---|---|---|
committer | Sean Dague | 2008-06-11 21:01:33 +0000 |
commit | 6c1fce61473b8d3faf9ee4602b9d0a392f148b7c (patch) | |
tree | 0cb0091493f725c0b06c2ceba493220eb85d507d /OpenSim/Data/SQLite/SQLiteAssetData.cs | |
parent | updated resources for current sqlite schema for migrations (diff) | |
download | opensim-SC_OLD-6c1fce61473b8d3faf9ee4602b9d0a392f148b7c.zip opensim-SC_OLD-6c1fce61473b8d3faf9ee4602b9d0a392f148b7c.tar.gz opensim-SC_OLD-6c1fce61473b8d3faf9ee4602b9d0a392f148b7c.tar.bz2 opensim-SC_OLD-6c1fce61473b8d3faf9ee4602b9d0a392f148b7c.tar.xz |
check in working migration code fore SQLite. This
is now using migrations instead of the old model to
create tables. Tested for existing old tables,
and for creating new ones.
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteAssetData.cs')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAssetData.cs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 8d4fb99..4370cf7 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -64,7 +64,19 @@ namespace OpenSim.Data.SQLite | |||
64 | } | 64 | } |
65 | m_conn = new SqliteConnection(dbconnect); | 65 | m_conn = new SqliteConnection(dbconnect); |
66 | m_conn.Open(); | 66 | m_conn.Open(); |
67 | TestTables(m_conn); | 67 | |
68 | |||
69 | |||
70 | |||
71 | Assembly assem = GetType().Assembly; | ||
72 | Migration m = new Migration(m_conn, assem, "AssetStore"); | ||
73 | // TODO: remove this next line after changeset 6000, | ||
74 | // people should have all gotten into the migration swing | ||
75 | // again. | ||
76 | TestTables(m_conn, m); | ||
77 | |||
78 | m.Update(); | ||
79 | |||
68 | return; | 80 | return; |
69 | } | 81 | } |
70 | 82 | ||
@@ -258,7 +270,7 @@ namespace OpenSim.Data.SQLite | |||
258 | pcmd.ExecuteNonQuery(); | 270 | pcmd.ExecuteNonQuery(); |
259 | } | 271 | } |
260 | 272 | ||
261 | private static bool TestTables(SqliteConnection conn) | 273 | private static bool TestTables(SqliteConnection conn, Migration m) |
262 | { | 274 | { |
263 | SqliteCommand cmd = new SqliteCommand(assetSelect, conn); | 275 | SqliteCommand cmd = new SqliteCommand(assetSelect, conn); |
264 | SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); | 276 | SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); |
@@ -270,8 +282,14 @@ namespace OpenSim.Data.SQLite | |||
270 | catch (SqliteSyntaxException) | 282 | catch (SqliteSyntaxException) |
271 | { | 283 | { |
272 | m_log.Info("[ASSET DB]: SQLite Database doesn't exist... creating"); | 284 | m_log.Info("[ASSET DB]: SQLite Database doesn't exist... creating"); |
273 | InitDB(conn); | 285 | return false; |
274 | } | 286 | } |
287 | |||
288 | // if the tables are here, and we don't have a migration, | ||
289 | // set it to 1, as we're migrating off of legacy bits | ||
290 | if (m.Version == 0) | ||
291 | m.Version = 1; | ||
292 | |||
275 | return true; | 293 | return true; |
276 | } | 294 | } |
277 | 295 | ||