diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index bb5a3f34ab..5c691a7a2a 100644 --- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs +++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs @@ -93,33 +93,6 @@ namespace OpenSim.Data.NHibernate Assembly assem = GetType().Assembly; Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "AssetStore"); m.Update(); - - } - - private void InitDB() - { - string regex = @"no such table: Assets"; - Regex RE = new Regex(regex, RegexOptions.Multiline); - try - { - using (ISession session = factory.OpenSession()) - { - session.Load(typeof(AssetBase), LLUUID.Zero); - } - } - catch (ObjectNotFoundException) - { - // yes, we know it's not there, but that's ok - } - catch (ADOException e) - { - Match m = RE.Match(e.ToString()); - if (m.Success) - { - // We don't have this table, so create it. - new SchemaExport(cfg).Create(true, true); - } - } } override public AssetBase FetchAsset(LLUUID uuid) diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs index 902ecfb512..2b36386953 100644 --- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs +++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs @@ -62,6 +62,7 @@ namespace OpenSim.Data.NHibernate // TODO: make this a real exception type throw new Exception("Malformed Inventory connection string '" + connect + "'"); } + string dialect = parts[0]; // Establish NHibernate Connection cfg = new Configuration(); @@ -74,46 +75,13 @@ namespace OpenSim.Data.NHibernate cfg.SetProperty(Environment.ConnectionString, parts[2]); cfg.AddAssembly("OpenSim.Data.NHibernate"); - HbmSerializer.Default.Validate = true; - using (MemoryStream stream = - HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) - cfg.AddInputStream(stream); - - // If uncommented this will auto create tables, but it - // does drops of the old tables, so we need a smarter way - // to acturally manage this. - - // new SchemaExport(cfg).Create(true, true); - factory = cfg.BuildSessionFactory(); - InitDB(); - } + // This actually does the roll forward assembly stuff + Assembly assem = GetType().Assembly; + Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "AssetStore"); + m.Update(); - private void InitDB() - { - string regex = @"no such table: Inventory"; - Regex RE = new Regex(regex, RegexOptions.Multiline); - try - { - using (ISession session = factory.OpenSession()) - { - session.Load(typeof(InventoryItemBase), LLUUID.Zero); - } - } - catch (ObjectNotFoundException) - { - // yes, we know it's not there, but that's ok - } - catch (ADOException e) - { - Match m = RE.Match(e.ToString()); - if (m.Success) - { - // We don't have this table, so create it. - new SchemaExport(cfg).Create(true, true); - } - } } /***************************************************************** diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index af9020d385..044c14aa17 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs @@ -61,6 +61,7 @@ namespace OpenSim.Data.NHibernate // TODO: make this a real exception type throw new Exception("Malformed Inventory connection string '" + connect + "'"); } + string dialect = parts[0]; // This is stubbing for now, it will become dynamic later and support different db backends cfg = new Configuration(); @@ -73,41 +74,12 @@ namespace OpenSim.Data.NHibernate cfg.SetProperty(Environment.ConnectionString, parts[2]); cfg.AddAssembly("OpenSim.Data.NHibernate"); - HbmSerializer.Default.Validate = true; - using (MemoryStream stream = - HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) - cfg.AddInputStream(stream); - - // new SchemaExport(cfg).Create(true, true); - factory = cfg.BuildSessionFactory(); - InitDB(); - } - private void InitDB() - { - string regex = @"no such table: UserProfiles"; - Regex RE = new Regex(regex, RegexOptions.Multiline); - try - { - using (ISession session = factory.OpenSession()) - { - session.Load(typeof(UserProfileData), LLUUID.Zero); - } - } - catch (ObjectNotFoundException) - { - // yes, we know it's not there, but that's ok - } - catch (ADOException e) - { - Match m = RE.Match(e.ToString()); - if (m.Success) - { - // We don't have this table, so create it. - new SchemaExport(cfg).Create(true, true); - } - } + // This actually does the roll forward assembly stuff + Assembly assem = GetType().Assembly; + Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "AssetStore"); + m.Update(); } private bool ExistsUser(LLUUID uuid) diff --git a/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml b/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml index 12ab98166b..261c13667b 100644 --- a/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml @@ -4,10 +4,10 @@ - - - - + + + + diff --git a/OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml b/OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml index 4411071657..8c6d02bab8 100644 --- a/OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/InventoryFolderBase.hbm.xml @@ -4,8 +4,8 @@ - - + + diff --git a/OpenSim/Data/NHibernate/Resources/InventoryItemBase.hbm.xml b/OpenSim/Data/NHibernate/Resources/InventoryItemBase.hbm.xml index c2e5c17369..debb2e52fb 100644 --- a/OpenSim/Data/NHibernate/Resources/InventoryItemBase.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/InventoryItemBase.hbm.xml @@ -4,23 +4,23 @@ - - + + - - - - + + + + - - + + \ No newline at end of file diff --git a/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml index b2abeaef39..718cb982ee 100644 --- a/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml @@ -5,7 +5,7 @@ - + @@ -13,7 +13,7 @@ - + diff --git a/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml index 3e4b5aa26c..cb83e2cd2c 100644 --- a/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml @@ -9,16 +9,16 @@ - - + + - - + +