diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index 7163a9213d..bb5a3f34ab 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. + + // 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(); - // new SchemaExport(cfg).Create(true, true); - - InitDB(); } private void InitDB() diff --git a/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml b/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml index 3c94d92cea..12ab98166b 100644 --- a/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml @@ -1,7 +1,7 @@ - + diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_AssetStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_AssetStore.sql new file mode 100644 index 0000000000..e553cff451 --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_AssetStore.sql @@ -0,0 +1,14 @@ +BEGIN TRANSACTION; + +create table Assets( + ID varchar(36) not null primary key, + Type int default 0, + InvType int default 0, + Name varchar(64), + Description varchar(64), + Local boolean, + Temporary boolean, + Data blob, +); + +END; \ No newline at end of file