From caa6b8467d9e15b0b9f49c70e45526b846f0d185 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 16 Jun 2008 18:53:55 +0000 Subject: futzing around on the NHibernate side again trying to connect migrations into it. --- OpenSim/Data/NHibernate/NHibernateAssetData.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'OpenSim/Data/NHibernate/NHibernateAssetData.cs') diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index 7163a92..bb5a3f3 100644 --- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs +++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs @@ -66,17 +66,21 @@ namespace OpenSim.Data.NHibernate throw new Exception("Malformed Inventory connection string '" + connect + "'"); } + string dialect = parts[0]; + // NHibernate setup cfg = new Configuration(); cfg.SetProperty(Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider"); cfg.SetProperty(Environment.Dialect, - "NHibernate.Dialect." + parts[0]); + "NHibernate.Dialect." + dialect); cfg.SetProperty(Environment.ConnectionDriver, "NHibernate.Driver." + parts[1]); cfg.SetProperty(Environment.ConnectionString, parts[2]); cfg.AddAssembly("OpenSim.Data.NHibernate"); + + HbmSerializer.Default.Validate = true; using (MemoryStream stream = HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) @@ -84,13 +88,12 @@ namespace OpenSim.Data.NHibernate factory = cfg.BuildSessionFactory(); - // 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); + + // 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(); - InitDB(); } private void InitDB() -- cgit v1.1