in theory fix the user table mapping
parent
260927bf68
commit
17496f3edf
|
@ -29,12 +29,14 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using libsecondlife;
|
||||
using log4net;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using NHibernate.Expression;
|
||||
using NHibernate.Mapping.Attributes;
|
||||
using NHibernate.Tool.hbm2ddl;
|
||||
using OpenSim.Framework;
|
||||
using Environment=NHibernate.Cfg.Environment;
|
||||
|
||||
|
@ -78,6 +80,26 @@ namespace OpenSim.Data.NHibernate
|
|||
// new SchemaExport(cfg).Create(true, true);
|
||||
|
||||
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)
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
<property name="UnderPantsAsset" 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="Texture" type="byte[]" />
|
||||
<property name="VisualParams" type="byte[]" />
|
||||
<property name="Texture" type="binary" />
|
||||
<property name="VisualParams" type="binary" />
|
||||
<property name="Serial" type="int" />
|
||||
</class>
|
||||
</hibernate-mapping>
|
Loading…
Reference in New Issue