futzing around on the NHibernate side again trying to connect

migrations into it.
0.6.0-stable
Sean Dague 2008-06-16 18:53:55 +00:00
parent e31de6707f
commit caa6b8467d
3 changed files with 25 additions and 8 deletions

View File

@ -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()

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="OpenSim.Framework.AssetBase, OpenSim.Framework" table="Assets" lazy="false">
<id name="FullID" column="UUID" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate">
<id name="FullID" column="ID" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate">
<generator class="assigned" />
</id>
<property name="Type" type="SByte" />

View File

@ -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;