futzing around on the NHibernate side again trying to connect
migrations into it.0.6.0-stable
parent
e31de6707f
commit
caa6b8467d
|
@ -66,17 +66,21 @@ namespace OpenSim.Data.NHibernate
|
||||||
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
throw new Exception("Malformed Inventory connection string '" + connect + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string dialect = parts[0];
|
||||||
|
|
||||||
// NHibernate setup
|
// NHibernate setup
|
||||||
cfg = new Configuration();
|
cfg = new Configuration();
|
||||||
cfg.SetProperty(Environment.ConnectionProvider,
|
cfg.SetProperty(Environment.ConnectionProvider,
|
||||||
"NHibernate.Connection.DriverConnectionProvider");
|
"NHibernate.Connection.DriverConnectionProvider");
|
||||||
cfg.SetProperty(Environment.Dialect,
|
cfg.SetProperty(Environment.Dialect,
|
||||||
"NHibernate.Dialect." + parts[0]);
|
"NHibernate.Dialect." + dialect);
|
||||||
cfg.SetProperty(Environment.ConnectionDriver,
|
cfg.SetProperty(Environment.ConnectionDriver,
|
||||||
"NHibernate.Driver." + parts[1]);
|
"NHibernate.Driver." + parts[1]);
|
||||||
cfg.SetProperty(Environment.ConnectionString, parts[2]);
|
cfg.SetProperty(Environment.ConnectionString, parts[2]);
|
||||||
cfg.AddAssembly("OpenSim.Data.NHibernate");
|
cfg.AddAssembly("OpenSim.Data.NHibernate");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HbmSerializer.Default.Validate = true;
|
HbmSerializer.Default.Validate = true;
|
||||||
using (MemoryStream stream =
|
using (MemoryStream stream =
|
||||||
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
|
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
|
||||||
|
@ -84,13 +88,12 @@ namespace OpenSim.Data.NHibernate
|
||||||
|
|
||||||
factory = cfg.BuildSessionFactory();
|
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()
|
private void InitDB()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||||
<class name="OpenSim.Framework.AssetBase, OpenSim.Framework" table="Assets" lazy="false">
|
<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" />
|
<generator class="assigned" />
|
||||||
</id>
|
</id>
|
||||||
<property name="Type" type="SByte" />
|
<property name="Type" type="SByte" />
|
||||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue