aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-29 17:21:17 +0000
committerJustin Clarke Casey2008-04-29 17:21:17 +0000
commit41207b5fa01cad8b8fc25a59568ed853a730d3b1 (patch)
tree1f1662da87ccef73d5c302c4789db19e5600e343 /OpenSim/Data
parentStuck an exception handler in the friends routine until I have time to debug ... (diff)
downloadopensim-SC-41207b5fa01cad8b8fc25a59568ed853a730d3b1.zip
opensim-SC-41207b5fa01cad8b8fc25a59568ed853a730d3b1.tar.gz
opensim-SC-41207b5fa01cad8b8fc25a59568ed853a730d3b1.tar.bz2
opensim-SC-41207b5fa01cad8b8fc25a59568ed853a730d3b1.tar.xz
* Preparatory work for autoupgrade of sqlite inventory tables in preparation for patches in mantis #923
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs38
1 files changed, 36 insertions, 2 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 2eb0ad5..5c53f32 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -74,12 +74,12 @@ namespace OpenSim.Data.SQLite
74 ds.Tables.Add(createInventoryFoldersTable()); 74 ds.Tables.Add(createInventoryFoldersTable());
75 invFoldersDa.Fill(ds.Tables["inventoryfolders"]); 75 invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
76 setupFoldersCommands(invFoldersDa, conn); 76 setupFoldersCommands(invFoldersDa, conn);
77 m_log.Info("[DATASTORE]: Populated Intentory Folders Definitions"); 77 m_log.Info("[DATASTORE]: Populated Inventory Folders Definitions");
78 78
79 ds.Tables.Add(createInventoryItemsTable()); 79 ds.Tables.Add(createInventoryItemsTable());
80 invItemsDa.Fill(ds.Tables["inventoryitems"]); 80 invItemsDa.Fill(ds.Tables["inventoryitems"]);
81 setupItemsCommands(invItemsDa, conn); 81 setupItemsCommands(invItemsDa, conn);
82 m_log.Info("[DATASTORE]: Populated Intentory Items Definitions"); 82 m_log.Info("[DATASTORE]: Populated Inventory Items Definitions");
83 83
84 ds.AcceptChanges(); 84 ds.AcceptChanges();
85 } 85 }
@@ -651,6 +651,40 @@ namespace OpenSim.Data.SQLite
651 pDa.Fill(tmpDS, "inventoryitems"); 651 pDa.Fill(tmpDS, "inventoryitems");
652 sDa.Fill(tmpDS, "inventoryfolders"); 652 sDa.Fill(tmpDS, "inventoryfolders");
653 653
654 // Very clumsy way of checking whether we need to upgrade the database table version and then updating. Only
655 // putting up with this because this code should be blown away soon by nhibernate...
656 conn.Open();
657
658 SqliteCommand cmd;
659 try
660 {
661 cmd = new SqliteCommand("select salePrice from inventoryitems limit 1;", conn);
662 cmd.ExecuteNonQuery();
663 }
664 catch (SqliteSyntaxException)
665 {
666 m_log.Info("[DATASTORE]: Upgrading sqlite inventory database to version 2");
667
668 cmd = new SqliteCommand("alter table inventoryitems add column salePrice integer default 99;", conn);
669 cmd.ExecuteNonQuery();
670 cmd = new SqliteCommand("alter table inventoryitems add column saleType integer default 0;", conn);
671 cmd.ExecuteNonQuery();
672 cmd = new SqliteCommand("alter table inventoryitems add column creationDate integer default 2000;", conn);
673 cmd.ExecuteNonQuery();
674 cmd = new SqliteCommand("alter table inventoryitems add column groupID varchar(255) default '00000000-0000-0000-0000-000000000000';", conn);
675 cmd.ExecuteNonQuery();
676 cmd = new SqliteCommand("alter table inventoryitems add column groupOwned integer default 0;", conn);
677 cmd.ExecuteNonQuery();
678 cmd = new SqliteCommand("alter table inventoryitems add column flags integer default 0;", conn);
679 cmd.ExecuteNonQuery();
680
681 pDa.Fill(tmpDS, "inventoryitems");
682 }
683 finally
684 {
685 conn.Close();
686 }
687
654 foreach (DataColumn col in createInventoryItemsTable().Columns) 688 foreach (DataColumn col in createInventoryItemsTable().Columns)
655 { 689 {
656 if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName)) 690 if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName))