diff options
author | Charles Krinke | 2009-02-14 19:47:02 +0000 |
---|---|---|
committer | Charles Krinke | 2009-02-14 19:47:02 +0000 |
commit | a583d8ad70daad8c755c2f43e2f2af7bc5b7ee4d (patch) | |
tree | 7e90740b7ea86922db55905a34e3b6e065cb6041 /OpenSim/Data/NHibernate/Resources | |
parent | Add an override for the % operator. (diff) | |
download | opensim-SC-a583d8ad70daad8c755c2f43e2f2af7bc5b7ee4d.zip opensim-SC-a583d8ad70daad8c755c2f43e2f2af7bc5b7ee4d.tar.gz opensim-SC-a583d8ad70daad8c755c2f43e2f2af7bc5b7ee4d.tar.bz2 opensim-SC-a583d8ad70daad8c755c2f43e2f2af7bc5b7ee4d.tar.xz |
Thank you kindly, TLaukkan (Tommil) for a patch that:
* Created value object for EstateRegionLink for storing the estate region relationship.
* Refactored slightly NHibernateManager and NHibernateXXXXData implementations for accesing nhibernate generated ID on insert.
** Changed NHibernateManager.Save method name to Insert as it does Insert.
** Changed NHibernateManager.Save return value object as ID can be both UUID and uint currently.
** Changed NHibernateManager.Load method Id parameter to object as it can be both UUID and uint.
* Created NHibernateEstateData implementation. This is the actual estate storage.
* Created NHibernate mapping files for both EstateSettings and EstateRegionLink
* Created MigrationSyntaxDifferences.txt files to write notes about differences in migration scripts between different databases.
* Created estate storage migration scripts for all four databases.
* Created estate unit test classes for all four databases.
* Updated one missing field to BasicEstateTest.cs
* Tested NHibernate unit tests with NUnit GUI. Asset databases fail but that is not related to this patch.
* Tested build with both Visual Studio and nant.
* Executed build tests with nant succesfully.
Diffstat (limited to '')
7 files changed, 225 insertions, 0 deletions
diff --git a/OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml b/OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml new file mode 100644 index 0000000..91bddee --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> | ||
3 | <class name="OpenSim.Data.NHibernate.EstateRegionLink, OpenSim.Data.NHibernate" table="EstateRegionLink" lazy="false"> | ||
4 | <id name="EstateRegionLinkID" column="EstateRegionLinkID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"> | ||
5 | <generator class="assigned" /> | ||
6 | </id> | ||
7 | |||
8 | <property name="EstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> | ||
9 | <property name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> | ||
10 | |||
11 | </class> | ||
12 | </hibernate-mapping> | ||
diff --git a/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml b/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml new file mode 100644 index 0000000..1ff0f10 --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml | |||
@@ -0,0 +1,39 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> | ||
3 | <class name="OpenSim.Framework.EstateSettings, OpenSim.Framework" table="EstateSettings" lazy="false"> | ||
4 | |||
5 | <id name="EstateID" column="EstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate"> | ||
6 | <generator class="increment" /> | ||
7 | </id> | ||
8 | |||
9 | <property name="ParentEstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> | ||
10 | <property name="EstateOwner" column="EstateOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> | ||
11 | |||
12 | <property name="EstateName" column="Name" type="String" length="64" /> | ||
13 | |||
14 | <property name="RedirectGridX" type="System.Int32" /> | ||
15 | <property name="RedirectGridY" type="System.Int32" /> | ||
16 | |||
17 | <property name="BillableFactor" type="System.Single" /> | ||
18 | <property name="PricePerMeter" type="System.Int32" /> | ||
19 | <property name="SunPosition" type="System.Double" /> | ||
20 | |||
21 | <property name="UseGlobalTime" type="System.Boolean" /> | ||
22 | <property name="FixedSun" type="System.Boolean" /> | ||
23 | <property name="AllowVoice" type="System.Boolean" /> | ||
24 | <property name="AllowDirectTeleport" type="System.Boolean" /> | ||
25 | <property name="ResetHomeOnTeleport" type="System.Boolean" /> | ||
26 | <property name="PublicAccess" type="System.Boolean" /> | ||
27 | <property name="DenyAnonymous" type="System.Boolean" /> | ||
28 | <property name="DenyIdentified" type="System.Boolean" /> | ||
29 | <property name="DenyTransacted" type="System.Boolean" /> | ||
30 | <property name="DenyMinors" type="System.Boolean" /> | ||
31 | <property name="BlockDwell" type="System.Boolean" /> | ||
32 | <property name="EstateSkipScripts" type="System.Boolean" /> | ||
33 | <property name="TaxFree" type="System.Boolean" /> | ||
34 | <property name="AbuseEmailToEstateOwner" type="System.Boolean" /> | ||
35 | |||
36 | <property name="AbuseEmail" type="String" length="255" /> | ||
37 | |||
38 | </class> | ||
39 | </hibernate-mapping> | ||
diff --git a/OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt b/OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt new file mode 100644 index 0000000..f3d86df --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt | |||
@@ -0,0 +1,14 @@ | |||
1 | ?This file describes the differences in schema creation and migration scripts. | ||
2 | |||
3 | MySQL is used as reference script against which differences are listed. | ||
4 | |||
5 | Generally MySQL create table options should be removed for other databases. | ||
6 | |||
7 | _PostgreSQL_ | ||
8 | * DOUBLE->DOUBLE PRECISION | ||
9 | * BIT->BOOLEAN | ||
10 | |||
11 | _MsSql_ | ||
12 | * VARCHAR->NVARCHAR | ||
13 | * Remove DEFAULT-keywords | ||
14 | * DOUBLE->REAL | ||
diff --git a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql new file mode 100644 index 0000000..893e2a2 --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql | |||
@@ -0,0 +1,40 @@ | |||
1 | CREATE TABLE EstateSettings ( | ||
2 | EstateID INT NOT NULL, | ||
3 | ParentEstateID INT NULL, | ||
4 | EstateOwnerID NVARCHAR(36) NULL, | ||
5 | Name NVARCHAR(64) NULL, | ||
6 | RedirectGridX INT NULL, | ||
7 | RedirectGridY INT NULL, | ||
8 | BillableFactor REAL NULL, | ||
9 | PricePerMeter INT NULL, | ||
10 | SunPosition REAL NULL, | ||
11 | |||
12 | UseGlobalTime BIT NULL, | ||
13 | FixedSun BIT NULL, | ||
14 | AllowVoice BIT NULL, | ||
15 | AllowDirectTeleport BIT NULL, | ||
16 | ResetHomeOnTeleport BIT NULL, | ||
17 | PublicAccess BIT NULL, | ||
18 | DenyAnonymous BIT NULL, | ||
19 | DenyIdentified BIT NULL, | ||
20 | DenyTransacted BIT NULL, | ||
21 | DenyMinors BIT NULL, | ||
22 | BlockDwell BIT NULL, | ||
23 | EstateSkipScripts BIT NULL, | ||
24 | TaxFree BIT NULL, | ||
25 | AbuseEmailToEstateOwner BIT NULL, | ||
26 | |||
27 | AbuseEmail NVARCHAR(255) NULL, | ||
28 | |||
29 | PRIMARY KEY (EstateID) | ||
30 | ); | ||
31 | |||
32 | CREATE TABLE EstateRegionLink ( | ||
33 | EstateRegionLinkID NVARCHAR(36) NOT NULL, | ||
34 | EstateID INT NULL, | ||
35 | RegionID NVARCHAR(36) NULL, | ||
36 | PRIMARY KEY (EstateRegionLinkID) | ||
37 | ); | ||
38 | |||
39 | CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); | ||
40 | CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); | ||
diff --git a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql new file mode 100644 index 0000000..a791bc6 --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql | |||
@@ -0,0 +1,40 @@ | |||
1 | CREATE TABLE EstateSettings ( | ||
2 | EstateID INT NOT NULL, | ||
3 | ParentEstateID INT DEFAULT NULL, | ||
4 | EstateOwnerID VARCHAR(36) DEFAULT NULL, | ||
5 | Name VARCHAR(64) DEFAULT NULL, | ||
6 | RedirectGridX INT DEFAULT NULL, | ||
7 | RedirectGridY INT DEFAULT NULL, | ||
8 | BillableFactor DOUBLE DEFAULT NULL, | ||
9 | PricePerMeter INT DEFAULT NULL, | ||
10 | SunPosition DOUBLE DEFAULT NULL, | ||
11 | |||
12 | UseGlobalTime BIT DEFAULT NULL, | ||
13 | FixedSun BIT DEFAULT NULL, | ||
14 | AllowVoice BIT DEFAULT NULL, | ||
15 | AllowDirectTeleport BIT DEFAULT NULL, | ||
16 | ResetHomeOnTeleport BIT DEFAULT NULL, | ||
17 | PublicAccess BIT DEFAULT NULL, | ||
18 | DenyAnonymous BIT DEFAULT NULL, | ||
19 | DenyIdentified BIT DEFAULT NULL, | ||
20 | DenyTransacted BIT DEFAULT NULL, | ||
21 | DenyMinors BIT DEFAULT NULL, | ||
22 | BlockDwell BIT DEFAULT NULL, | ||
23 | EstateSkipScripts BIT DEFAULT NULL, | ||
24 | TaxFree BIT DEFAULT NULL, | ||
25 | AbuseEmailToEstateOwner BIT DEFAULT NULL, | ||
26 | |||
27 | AbuseEmail VARCHAR(255) DEFAULT NULL, | ||
28 | |||
29 | PRIMARY KEY (EstateID) | ||
30 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; | ||
31 | |||
32 | CREATE TABLE EstateRegionLink ( | ||
33 | EstateRegionLinkID VARCHAR(36) NOT NULL, | ||
34 | EstateID INT DEFAULT NULL, | ||
35 | RegionID VARCHAR(36) DEFAULT NULL, | ||
36 | PRIMARY KEY (EstateRegionLinkID) | ||
37 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; | ||
38 | |||
39 | CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); | ||
40 | CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); | ||
diff --git a/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql new file mode 100644 index 0000000..421a0c4 --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql | |||
@@ -0,0 +1,40 @@ | |||
1 | CREATE TABLE EstateSettings ( | ||
2 | EstateID INT NOT NULL, | ||
3 | ParentEstateID INT DEFAULT NULL, | ||
4 | EstateOwnerID VARCHAR(36) DEFAULT NULL, | ||
5 | Name VARCHAR(64) DEFAULT NULL, | ||
6 | RedirectGridX INT DEFAULT NULL, | ||
7 | RedirectGridY INT DEFAULT NULL, | ||
8 | BillableFactor DOUBLE PRECISION DEFAULT NULL, | ||
9 | PricePerMeter INT DEFAULT NULL, | ||
10 | SunPosition DOUBLE PRECISION DEFAULT NULL, | ||
11 | |||
12 | UseGlobalTime BOOLEAN DEFAULT NULL, | ||
13 | FixedSun BOOLEAN DEFAULT NULL, | ||
14 | AllowVoice BOOLEAN DEFAULT NULL, | ||
15 | AllowDirectTeleport BOOLEAN DEFAULT NULL, | ||
16 | ResetHomeOnTeleport BOOLEAN DEFAULT NULL, | ||
17 | PublicAccess BOOLEAN DEFAULT NULL, | ||
18 | DenyAnonymous BOOLEAN DEFAULT NULL, | ||
19 | DenyIdentified BOOLEAN DEFAULT NULL, | ||
20 | DenyTransacted BOOLEAN DEFAULT NULL, | ||
21 | DenyMinors BOOLEAN DEFAULT NULL, | ||
22 | BlockDwell BOOLEAN DEFAULT NULL, | ||
23 | EstateSkipScripts BOOLEAN DEFAULT NULL, | ||
24 | TaxFree BOOLEAN DEFAULT NULL, | ||
25 | AbuseEmailToEstateOwner BOOLEAN DEFAULT NULL, | ||
26 | |||
27 | AbuseEmail VARCHAR(255) DEFAULT NULL, | ||
28 | |||
29 | PRIMARY KEY (EstateID) | ||
30 | ); | ||
31 | |||
32 | CREATE TABLE EstateRegionLink ( | ||
33 | EstateRegionLinkID VARCHAR(36) NOT NULL, | ||
34 | EstateID INT DEFAULT NULL, | ||
35 | RegionID VARCHAR(36) DEFAULT NULL, | ||
36 | PRIMARY KEY (EstateRegionLinkID) | ||
37 | ); | ||
38 | |||
39 | CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); | ||
40 | CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); | ||
diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql new file mode 100644 index 0000000..b16ae82 --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql | |||
@@ -0,0 +1,40 @@ | |||
1 | CREATE TABLE EstateSettings ( | ||
2 | EstateID INT NOT NULL, | ||
3 | ParentEstateID INT DEFAULT NULL, | ||
4 | EstateOwnerID VARCHAR(36) DEFAULT NULL, | ||
5 | Name VARCHAR(64) DEFAULT NULL, | ||
6 | RedirectGridX INT DEFAULT NULL, | ||
7 | RedirectGridY INT DEFAULT NULL, | ||
8 | BillableFactor DOUBLE DEFAULT NULL, | ||
9 | PricePerMeter INT DEFAULT NULL, | ||
10 | SunPosition DOUBLE DEFAULT NULL, | ||
11 | |||
12 | UseGlobalTime BIT DEFAULT NULL, | ||
13 | FixedSun BIT DEFAULT NULL, | ||
14 | AllowVoice BIT DEFAULT NULL, | ||
15 | AllowDirectTeleport BIT DEFAULT NULL, | ||
16 | ResetHomeOnTeleport BIT DEFAULT NULL, | ||
17 | PublicAccess BIT DEFAULT NULL, | ||
18 | DenyAnonymous BIT DEFAULT NULL, | ||
19 | DenyIdentified BIT DEFAULT NULL, | ||
20 | DenyTransacted BIT DEFAULT NULL, | ||
21 | DenyMinors BIT DEFAULT NULL, | ||
22 | BlockDwell BIT DEFAULT NULL, | ||
23 | EstateSkipScripts BIT DEFAULT NULL, | ||
24 | TaxFree BIT DEFAULT NULL, | ||
25 | AbuseEmailToEstateOwner BIT DEFAULT NULL, | ||
26 | |||
27 | AbuseEmail VARCHAR(255) DEFAULT NULL, | ||
28 | |||
29 | PRIMARY KEY (EstateID) | ||
30 | ); | ||
31 | |||
32 | CREATE TABLE EstateRegionLink ( | ||
33 | EstateRegionLinkID VARCHAR(36) NOT NULL, | ||
34 | EstateID INT DEFAULT NULL, | ||
35 | RegionID VARCHAR(36) DEFAULT NULL, | ||
36 | PRIMARY KEY (EstateRegionLinkID) | ||
37 | ); | ||
38 | |||
39 | CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); | ||
40 | CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); | ||