diff options
author | Sean Dague | 2008-06-16 18:53:55 +0000 |
---|---|---|
committer | Sean Dague | 2008-06-16 18:53:55 +0000 |
commit | caa6b8467d9e15b0b9f49c70e45526b846f0d185 (patch) | |
tree | 411449f140622d8c17e0146d0cb67aeec6a9feb3 | |
parent | * refactor: Fission ArchiveWriteRequest into prepare and execute classes (diff) | |
download | opensim-SC-caa6b8467d9e15b0b9f49c70e45526b846f0d185.zip opensim-SC-caa6b8467d9e15b0b9f49c70e45526b846f0d185.tar.gz opensim-SC-caa6b8467d9e15b0b9f49c70e45526b846f0d185.tar.bz2 opensim-SC-caa6b8467d9e15b0b9f49c70e45526b846f0d185.tar.xz |
futzing around on the NHibernate side again trying to connect
migrations into it.
3 files changed, 25 insertions, 8 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index 7163a92..bb5a3f3 100644 --- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs +++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs | |||
@@ -66,17 +66,21 @@ namespace OpenSim.Data.NHibernate | |||
66 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); | 66 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); |
67 | } | 67 | } |
68 | 68 | ||
69 | string dialect = parts[0]; | ||
70 | |||
69 | // NHibernate setup | 71 | // NHibernate setup |
70 | cfg = new Configuration(); | 72 | cfg = new Configuration(); |
71 | cfg.SetProperty(Environment.ConnectionProvider, | 73 | cfg.SetProperty(Environment.ConnectionProvider, |
72 | "NHibernate.Connection.DriverConnectionProvider"); | 74 | "NHibernate.Connection.DriverConnectionProvider"); |
73 | cfg.SetProperty(Environment.Dialect, | 75 | cfg.SetProperty(Environment.Dialect, |
74 | "NHibernate.Dialect." + parts[0]); | 76 | "NHibernate.Dialect." + dialect); |
75 | cfg.SetProperty(Environment.ConnectionDriver, | 77 | cfg.SetProperty(Environment.ConnectionDriver, |
76 | "NHibernate.Driver." + parts[1]); | 78 | "NHibernate.Driver." + parts[1]); |
77 | cfg.SetProperty(Environment.ConnectionString, parts[2]); | 79 | cfg.SetProperty(Environment.ConnectionString, parts[2]); |
78 | cfg.AddAssembly("OpenSim.Data.NHibernate"); | 80 | cfg.AddAssembly("OpenSim.Data.NHibernate"); |
79 | 81 | ||
82 | |||
83 | |||
80 | HbmSerializer.Default.Validate = true; | 84 | HbmSerializer.Default.Validate = true; |
81 | using (MemoryStream stream = | 85 | using (MemoryStream stream = |
82 | HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) | 86 | HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) |
@@ -84,13 +88,12 @@ namespace OpenSim.Data.NHibernate | |||
84 | 88 | ||
85 | factory = cfg.BuildSessionFactory(); | 89 | factory = cfg.BuildSessionFactory(); |
86 | 90 | ||
87 | // If uncommented this will auto create tables, but it | 91 | |
88 | // does drops of the old tables, so we need a smarter way | 92 | // This actually does the roll forward assembly stuff |
89 | // to acturally manage this. | 93 | Assembly assem = GetType().Assembly; |
90 | 94 | Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "AssetStore"); | |
91 | // new SchemaExport(cfg).Create(true, true); | 95 | m.Update(); |
92 | 96 | ||
93 | InitDB(); | ||
94 | } | 97 | } |
95 | 98 | ||
96 | private void InitDB() | 99 | private void InitDB() |
diff --git a/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml b/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml index 3c94d92..12ab981 100644 --- a/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml | |||
@@ -1,7 +1,7 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | 1 | <?xml version="1.0" encoding="utf-8" ?> |
2 | <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> | 2 | <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> |
3 | <class name="OpenSim.Framework.AssetBase, OpenSim.Framework" table="Assets" lazy="false"> | 3 | <class name="OpenSim.Framework.AssetBase, OpenSim.Framework" table="Assets" lazy="false"> |
4 | <id name="FullID" column="UUID" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate"> | 4 | <id name="FullID" column="ID" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate"> |
5 | <generator class="assigned" /> | 5 | <generator class="assigned" /> |
6 | </id> | 6 | </id> |
7 | <property name="Type" type="SByte" /> | 7 | <property name="Type" type="SByte" /> |
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 0000000..e553cff --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_AssetStore.sql | |||
@@ -0,0 +1,14 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | create table Assets( | ||
4 | ID varchar(36) not null primary key, | ||
5 | Type int default 0, | ||
6 | InvType int default 0, | ||
7 | Name varchar(64), | ||
8 | Description varchar(64), | ||
9 | Local boolean, | ||
10 | Temporary boolean, | ||
11 | Data blob, | ||
12 | ); | ||
13 | |||
14 | END; \ No newline at end of file | ||