From a583d8ad70daad8c755c2f43e2f2af7bc5b7ee4d Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sat, 14 Feb 2009 19:47:02 +0000 Subject: 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. --- .../NHibernate/Resources/EstateRegionLink.hbm.xml | 12 +++++++ .../NHibernate/Resources/EstateSettings.hbm.xml | 39 +++++++++++++++++++++ .../Resources/MigrationSyntaxDifferences.txt | 14 ++++++++ .../Resources/MsSql2005Dialect/001_EstateStore.sql | 40 ++++++++++++++++++++++ .../Resources/MySQLDialect/001_EstateStore.sql | 40 ++++++++++++++++++++++ .../PostgreSQLDialect/001_EstateStore.sql | 40 ++++++++++++++++++++++ .../Resources/SQLiteDialect/001_EstateStore.sql | 40 ++++++++++++++++++++++ 7 files changed, 225 insertions(+) create mode 100644 OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml create mode 100644 OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml create mode 100644 OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt create mode 100644 OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql create mode 100644 OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql create mode 100644 OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql create mode 100644 OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql (limited to 'OpenSim/Data/NHibernate/Resources') 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 @@ + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ +?This file describes the differences in schema creation and migration scripts. + +MySQL is used as reference script against which differences are listed. + +Generally MySQL create table options should be removed for other databases. + +_PostgreSQL_ +* DOUBLE->DOUBLE PRECISION +* BIT->BOOLEAN + +_MsSql_ +* VARCHAR->NVARCHAR +* Remove DEFAULT-keywords +* 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 @@ +CREATE TABLE EstateSettings ( + EstateID INT NOT NULL, + ParentEstateID INT NULL, + EstateOwnerID NVARCHAR(36) NULL, + Name NVARCHAR(64) NULL, + RedirectGridX INT NULL, + RedirectGridY INT NULL, + BillableFactor REAL NULL, + PricePerMeter INT NULL, + SunPosition REAL NULL, + + UseGlobalTime BIT NULL, + FixedSun BIT NULL, + AllowVoice BIT NULL, + AllowDirectTeleport BIT NULL, + ResetHomeOnTeleport BIT NULL, + PublicAccess BIT NULL, + DenyAnonymous BIT NULL, + DenyIdentified BIT NULL, + DenyTransacted BIT NULL, + DenyMinors BIT NULL, + BlockDwell BIT NULL, + EstateSkipScripts BIT NULL, + TaxFree BIT NULL, + AbuseEmailToEstateOwner BIT NULL, + + AbuseEmail NVARCHAR(255) NULL, + + PRIMARY KEY (EstateID) +); + +CREATE TABLE EstateRegionLink ( + EstateRegionLinkID NVARCHAR(36) NOT NULL, + EstateID INT NULL, + RegionID NVARCHAR(36) NULL, + PRIMARY KEY (EstateRegionLinkID) +); + +CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); +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 @@ +CREATE TABLE EstateSettings ( + EstateID INT NOT NULL, + ParentEstateID INT DEFAULT NULL, + EstateOwnerID VARCHAR(36) DEFAULT NULL, + Name VARCHAR(64) DEFAULT NULL, + RedirectGridX INT DEFAULT NULL, + RedirectGridY INT DEFAULT NULL, + BillableFactor DOUBLE DEFAULT NULL, + PricePerMeter INT DEFAULT NULL, + SunPosition DOUBLE DEFAULT NULL, + + UseGlobalTime BIT DEFAULT NULL, + FixedSun BIT DEFAULT NULL, + AllowVoice BIT DEFAULT NULL, + AllowDirectTeleport BIT DEFAULT NULL, + ResetHomeOnTeleport BIT DEFAULT NULL, + PublicAccess BIT DEFAULT NULL, + DenyAnonymous BIT DEFAULT NULL, + DenyIdentified BIT DEFAULT NULL, + DenyTransacted BIT DEFAULT NULL, + DenyMinors BIT DEFAULT NULL, + BlockDwell BIT DEFAULT NULL, + EstateSkipScripts BIT DEFAULT NULL, + TaxFree BIT DEFAULT NULL, + AbuseEmailToEstateOwner BIT DEFAULT NULL, + + AbuseEmail VARCHAR(255) DEFAULT NULL, + + PRIMARY KEY (EstateID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; + +CREATE TABLE EstateRegionLink ( + EstateRegionLinkID VARCHAR(36) NOT NULL, + EstateID INT DEFAULT NULL, + RegionID VARCHAR(36) DEFAULT NULL, + PRIMARY KEY (EstateRegionLinkID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; + +CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); +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 @@ +CREATE TABLE EstateSettings ( + EstateID INT NOT NULL, + ParentEstateID INT DEFAULT NULL, + EstateOwnerID VARCHAR(36) DEFAULT NULL, + Name VARCHAR(64) DEFAULT NULL, + RedirectGridX INT DEFAULT NULL, + RedirectGridY INT DEFAULT NULL, + BillableFactor DOUBLE PRECISION DEFAULT NULL, + PricePerMeter INT DEFAULT NULL, + SunPosition DOUBLE PRECISION DEFAULT NULL, + + UseGlobalTime BOOLEAN DEFAULT NULL, + FixedSun BOOLEAN DEFAULT NULL, + AllowVoice BOOLEAN DEFAULT NULL, + AllowDirectTeleport BOOLEAN DEFAULT NULL, + ResetHomeOnTeleport BOOLEAN DEFAULT NULL, + PublicAccess BOOLEAN DEFAULT NULL, + DenyAnonymous BOOLEAN DEFAULT NULL, + DenyIdentified BOOLEAN DEFAULT NULL, + DenyTransacted BOOLEAN DEFAULT NULL, + DenyMinors BOOLEAN DEFAULT NULL, + BlockDwell BOOLEAN DEFAULT NULL, + EstateSkipScripts BOOLEAN DEFAULT NULL, + TaxFree BOOLEAN DEFAULT NULL, + AbuseEmailToEstateOwner BOOLEAN DEFAULT NULL, + + AbuseEmail VARCHAR(255) DEFAULT NULL, + + PRIMARY KEY (EstateID) +); + +CREATE TABLE EstateRegionLink ( + EstateRegionLinkID VARCHAR(36) NOT NULL, + EstateID INT DEFAULT NULL, + RegionID VARCHAR(36) DEFAULT NULL, + PRIMARY KEY (EstateRegionLinkID) +); + +CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); +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 @@ +CREATE TABLE EstateSettings ( + EstateID INT NOT NULL, + ParentEstateID INT DEFAULT NULL, + EstateOwnerID VARCHAR(36) DEFAULT NULL, + Name VARCHAR(64) DEFAULT NULL, + RedirectGridX INT DEFAULT NULL, + RedirectGridY INT DEFAULT NULL, + BillableFactor DOUBLE DEFAULT NULL, + PricePerMeter INT DEFAULT NULL, + SunPosition DOUBLE DEFAULT NULL, + + UseGlobalTime BIT DEFAULT NULL, + FixedSun BIT DEFAULT NULL, + AllowVoice BIT DEFAULT NULL, + AllowDirectTeleport BIT DEFAULT NULL, + ResetHomeOnTeleport BIT DEFAULT NULL, + PublicAccess BIT DEFAULT NULL, + DenyAnonymous BIT DEFAULT NULL, + DenyIdentified BIT DEFAULT NULL, + DenyTransacted BIT DEFAULT NULL, + DenyMinors BIT DEFAULT NULL, + BlockDwell BIT DEFAULT NULL, + EstateSkipScripts BIT DEFAULT NULL, + TaxFree BIT DEFAULT NULL, + AbuseEmailToEstateOwner BIT DEFAULT NULL, + + AbuseEmail VARCHAR(255) DEFAULT NULL, + + PRIMARY KEY (EstateID) +); + +CREATE TABLE EstateRegionLink ( + EstateRegionLinkID VARCHAR(36) NOT NULL, + EstateID INT DEFAULT NULL, + RegionID VARCHAR(36) DEFAULT NULL, + PRIMARY KEY (EstateRegionLinkID) +); + +CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); +CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); -- cgit v1.1