in theory fix the user table mapping
parent
260927bf68
commit
17496f3edf
|
@ -29,12 +29,14 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using log4net;
|
using log4net;
|
||||||
using NHibernate;
|
using NHibernate;
|
||||||
using NHibernate.Cfg;
|
using NHibernate.Cfg;
|
||||||
using NHibernate.Expression;
|
using NHibernate.Expression;
|
||||||
using NHibernate.Mapping.Attributes;
|
using NHibernate.Mapping.Attributes;
|
||||||
|
using NHibernate.Tool.hbm2ddl;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using Environment=NHibernate.Cfg.Environment;
|
using Environment=NHibernate.Cfg.Environment;
|
||||||
|
|
||||||
|
@ -78,6 +80,26 @@ namespace OpenSim.Data.NHibernate
|
||||||
// new SchemaExport(cfg).Create(true, true);
|
// new SchemaExport(cfg).Create(true, true);
|
||||||
|
|
||||||
factory = cfg.BuildSessionFactory();
|
factory = cfg.BuildSessionFactory();
|
||||||
|
InitDB();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitDB()
|
||||||
|
{
|
||||||
|
string regex = @"no such table: Users";
|
||||||
|
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
||||||
|
try {
|
||||||
|
using(ISession session = factory.OpenSession()) {
|
||||||
|
session.Load(typeof(InventoryItemBase), LLUUID.Zero);
|
||||||
|
}
|
||||||
|
} catch (ObjectNotFoundException e) {
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ExistsUser(LLUUID uuid)
|
private bool ExistsUser(LLUUID uuid)
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
<property name="UnderPantsAsset" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="UnderPantsAsset" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="SkirtItem" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="SkirtItem" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="SkirtAsset" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
|
<property name="SkirtAsset" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
|
||||||
<property name="Texture" type="byte[]" />
|
<property name="Texture" type="binary" />
|
||||||
<property name="VisualParams" type="byte[]" />
|
<property name="VisualParams" type="binary" />
|
||||||
<property name="Serial" type="int" />
|
<property name="Serial" type="int" />
|
||||||
</class>
|
</class>
|
||||||
</hibernate-mapping>
|
</hibernate-mapping>
|
Loading…
Reference in New Issue