From c00c855cc5decf73d598af5d74a2ef57c547efd3 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 12 Jan 2009 20:14:39 +0000 Subject: Thank you kindly, Tlaukkan (Tommil) for a patch that: Cleaned up schema creation scripts of MySQL to compliant form and created SQLite scripts from them. In future it would be optimal if scripts from different databases could be generated from MySQL scripts to ensure optimal consistency between schemas of different databases. Did not yet review column names. ID columns seem to have variety in naming which can be confusing. --- .../Resources/SQLiteDialect/001_AssetStore.sql | 22 +- .../Resources/SQLiteDialect/001_GridStore.sql | 69 +++-- .../Resources/SQLiteDialect/001_InventoryStore.sql | 69 +++-- .../Resources/SQLiteDialect/001_RegionStore.sql | 306 +++++++++++---------- .../Resources/SQLiteDialect/001_UserStore.sql | 194 +++++++------ 5 files changed, 333 insertions(+), 327 deletions(-) (limited to 'OpenSim/Data/NHibernate/Resources/SQLiteDialect') diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_AssetStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_AssetStore.sql index 07994f4..15e10b3 100644 --- a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_AssetStore.sql +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_AssetStore.sql @@ -1,14 +1,10 @@ -BEGIN TRANSACTION; - -create table Assets( - ID varchar(36) not null primary key, - Type int default 0, - InvType int default 0, - Name varchar(64), - Description varchar(64), - Local boolean, - Temporary boolean, - Data blob +CREATE TABLE Assets ( + ID VARCHAR(36) NOT NULL, + Type TINYINT DEFAULT NULL, + Name VARCHAR(64) DEFAULT NULL, + Description VARCHAR(64) DEFAULT NULL, + Local BIT DEFAULT NULL, + Temporary BIT DEFAULT NULL, + Data BLOB, + PRIMARY KEY (ID) ); - -END; \ No newline at end of file diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_GridStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_GridStore.sql index 1cb18e3..336a277 100644 --- a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_GridStore.sql +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_GridStore.sql @@ -1,38 +1,35 @@ -BEGIN TRANSACTION; - -create table Regions ( - Uuid NVARCHAR(255) not null, - RegionHandle BIGINT null, - RegionName NVARCHAR(32) null, - RegionRecvKey NVARCHAR(128) null, - RegionSendKey NVARCHAR(128) null, - RegionSecret NVARCHAR(128) null, - RegionDataURI NVARCHAR(255) null, - ServerIP NVARCHAR(64) null, - ServerPort INT null, - ServerURI NVARCHAR(255) null, - RegionLocX INT null, - RegionLocY INT null, - RegionLocZ INT null, - EastOverrideHandle BIGINT null, - WestOverrideHandle BIGINT null, - SouthOverrideHandle BIGINT null, - NorthOverrideHandle BIGINT null, - RegionAssetURI NVARCHAR(255) null, - RegionAssetRecvKey NVARCHAR(128) null, - RegionAssetSendKey NVARCHAR(128) null, - RegionUserURI NVARCHAR(255) null, - RegionUserRecvKey NVARCHAR(128) null, - RegionUserSendKey NVARCHAR(128) null, - ServerHttpPort INT null, - ServerRemotingPort INT null, - RegionMapTextureID NVARCHAR(255) null, - Owner_uuid NVARCHAR(255) null, - OriginUUID NVARCHAR(255) null, - primary key (Uuid) +CREATE TABLE Regions ( + RegionId VARCHAR(36) NOT NULL, + RegionHandle BIGINT UNSIGNED NOT NULL, + RegionName VARCHAR(32) DEFAULT NULL, + RegionRecvKey VARCHAR(128) DEFAULT NULL, + RegionSendKey VARCHAR(128) DEFAULT NULL, + RegionSecret VARCHAR(128) DEFAULT NULL, + RegionDataURI VARCHAR(255) DEFAULT NULL, + ServerIP VARCHAR(64) DEFAULT NULL, + ServerPort INT UNSIGNED DEFAULT NULL, + ServerURI VARCHAR(255) DEFAULT NULL, + RegionLocX INT UNSIGNED DEFAULT NULL, + RegionLocY INT UNSIGNED DEFAULT NULL, + RegionLocZ INT UNSIGNED DEFAULT NULL, + EastOverrideHandle BIGINT UNSIGNED DEFAULT NULL, + WestOverrideHandle BIGINT UNSIGNED DEFAULT NULL, + SouthOverrideHandle BIGINT UNSIGNED DEFAULT NULL, + NorthOverrideHandle BIGINT UNSIGNED DEFAULT NULL, + RegionAssetURI VARCHAR(255) DEFAULT NULL, + RegionAssetRecvKey VARCHAR(128) DEFAULT NULL, + RegionAssetSendKey VARCHAR(128) DEFAULT NULL, + RegionUserURI VARCHAR(255) DEFAULT NULL, + RegionUserRecvKey VARCHAR(128) DEFAULT NULL, + RegionUserSendKey VARCHAR(128) DEFAULT NULL, + regionMapTexture VARCHAR(36) DEFAULT NULL, + ServerHttpPort INT DEFAULT NULL, + ServerRemotingPort INT DEFAULT NULL, + OwnerID VARCHAR(36) DEFAULT NULL, + OriginID VARCHAR(36) DEFAULT NULL, + PRIMARY KEY (uuid), ); -create index region_handle on Regions (RegionHandle); -create index region_name on Regions (RegionName); - -COMMIT; \ No newline at end of file +CREATE INDEX RegionNameIndex ON Regions (RegionName); +CREATE INDEX RegionHandleIndex ON Regions (RegionHandle); +CREATE INDEX RegionHandlesIndex ON Regions (EastOverrideHandle,WestOverrideHandle,SouthOverrideHandle,NorthOverrideHandle); diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_InventoryStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_InventoryStore.sql index 89892df..5f4dcaa 100644 --- a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_InventoryStore.sql +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_InventoryStore.sql @@ -1,40 +1,39 @@ -BEGIN TRANSACTION; - CREATE TABLE InventoryFolders ( - ID varchar(36) not null primary key, - Type int, - Version int, - ParentID varchar(36), - Owner varchar(36), - Name varchar(64) + ID VARCHAR(36) NOT NULL, + Type SMALLINT DEFAULT NULL, + Version SMALLINT DEFAULT NULL, + ParentID VARCHAR(36) DEFAULT NULL, + Owner VARCHAR(36) DEFAULT NULL, + Name VARCHAR(64) DEFAULT NULL, + PRIMARY KEY (ID) ); -create table InventoryItems ( - ID varchar(36) not null primary key, - InvType int, - AssetType int, - AssetID varchar(36), - Folder varchar(36), - Owner varchar(36), - Creator varchar(36), - Name varchar(64), - Description varchar(64), - NextPermissions int, - CurrentPermissions int, - BasePermissions int, - EveryOnePermissions int, - GroupID varchar(36), - GroupOwned int, - SalePrice int, - SaleType int, - Flags int, - CreationDate int -); +CREATE INDEX InventoryFoldersOwnerIdIndex ON InventoryFolders (Owner); +CREATE INDEX InventoryFoldersParentIdIndex ON InventoryFolders (ParentID); -CREATE INDEX folder_owner_id on InventoryFolders (Owner); -CREATE INDEX folder_parent_id on InventoryFolders (ParentID); -CREATE INDEX item_group_id on InventoryItems (GroupID); -CREATE INDEX item_owner_id on InventoryItems (Owner); -CREATE INDEX item_folder_id on InventoryItems (Folder); +CREATE TABLE InventoryItems ( + ID VARCHAR(36) NOT NULL, + InvType SMALLINT DEFAULT NULL, + AssetType SMALLINT DEFAULT NULL, + AssetID VARCHAR(36) DEFAULT NULL, + Folder VARCHAR(36) DEFAULT NULL, + Owner VARCHAR(36) DEFAULT NULL, + Creator VARCHAR(36) DEFAULT NULL, + Name VARCHAR(64) DEFAULT NULL, + Description VARCHAR(64) DEFAULT NULL, + NextPermissions INT DEFAULT NULL, + CurrentPermissions INT DEFAULT NULL, + BasePermissions INT DEFAULT NULL, + EveryOnePermissions INT DEFAULT NULL, + GroupID VARCHAR(36) DEFAULT NULL, + GroupOwned BIT DEFAULT NULL, + SalePrice INT DEFAULT NULL, + SaleType TINYINT DEFAULT NULL, + Flags INT DEFAULT NULL, + CreationDate INT DEFAULT NULL, + PRIMARY KEY (ID) +); -COMMIT; +CREATE INDEX InventoryItemsGroupIdIndex ON InventoryItems (GroupID); +CREATE INDEX InventoryItemsOwnerIdIndex ON InventoryItems (Owner); +CREATE INDEX InventoryItemsFolderIdIndex ON InventoryItems (Folder); diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql index eaa0964..7b591be 100644 --- a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql @@ -1,150 +1,168 @@ -BEGIN TRANSACTION; - -create table Prims ( - UUID TEXT not null, - RegionID TEXT, - GroupID TEXT, - ParentID INTEGER, - ParentUUID TEXT, - OwnerID TEXT, - LastOwnerID TEXT, - CreatorID TEXT, - CreationDate INTEGER, - LinkNum INTEGER, - Name TEXT, - Text TEXT, - Description TEXT, - SitName TEXT, - TouchName TEXT, - ObjectFlags INTEGER, - OwnerMask INTEGER, - NextOwnerMask INTEGER, - GroupMask INTEGER, - EveryoneMask INTEGER, - BaseMask INTEGER, - Material INTEGER, - ScriptAccessPin INTEGER, - TextureAnimation BLOB, - ParticleSystem BLOB, - ClickAction INTEGER, - Color INTEGER, - PositionX NUMERIC, - PositionY NUMERIC, - PositionZ NUMERIC, - GroupPositionX NUMERIC, - GroupPositionY NUMERIC, - GroupPositionZ NUMERIC, - VelocityX NUMERIC, - VelocityY NUMERIC, - VelocityZ NUMERIC, - AngularVelocityX NUMERIC, - AngularVelocityY NUMERIC, - AngularVelocityZ NUMERIC, - AccelerationX NUMERIC, - AccelerationY NUMERIC, - AccelerationZ NUMERIC, - SitTargetOffsetX NUMERIC, - SitTargetOffsetY NUMERIC, - SitTargetOffsetZ NUMERIC, - RotationX NUMERIC, - RotationY NUMERIC, - RotationZ NUMERIC, - RotationW NUMERIC, - SitTargetOrientX NUMERIC, - SitTargetOrientY NUMERIC, - SitTargetOrientZ NUMERIC, - SitTargetOrientW NUMERIC, - ScaleX NUMERIC, - ScaleY NUMERIC, - ScaleZ NUMERIC, - PCode INTEGER, - PathBegin INTEGER, - PathEnd INTEGER, - PathScaleX INTEGER, - PathScaleY INTEGER, - PathShearX INTEGER, - PathShearY INTEGER, - PathSkew INTEGER, - PathCurve INTEGER, - PathRadiusOffset INTEGER, - PathRevolutions INTEGER, - PathTaperX INTEGER, - PathTwist INTEGER, - ProfileBegin INTEGER, - ProfileEnd INTEGER, - ProfileCurve INTEGER, - ProfileHollow INTEGER, - Texture BLOB, - ExtraParams BLOB, - State INTEGER, - primary key (UUID) +CREATE TABLE Prims ( + UUID VARCHAR(36) NOT NULL, + RegionID VARCHAR(36) DEFAULT NULL, + GroupID VARCHAR(36) DEFAULT NULL, + ParentID INT DEFAULT NULL, + ParentUUID VARCHAR(36) DEFAULT NULL, + OwnerID VARCHAR(36) DEFAULT NULL, + LastOwnerID VARCHAR(36) DEFAULT NULL, + CreatorID VARCHAR(36) DEFAULT NULL, + CreationDate INT DEFAULT NULL, + LinkNum INT DEFAULT NULL, + Name VARCHAR(255) DEFAULT NULL, + Text VARCHAR(255) DEFAULT NULL, + Description VARCHAR(255) DEFAULT NULL, + SitName VARCHAR(255) DEFAULT NULL, + TouchName VARCHAR(255) DEFAULT NULL, + ObjectFlags INT DEFAULT NULL, + OwnerMask INT DEFAULT NULL, + NextOwnerMask INT DEFAULT NULL, + GroupMask INT DEFAULT NULL, + EveryoneMask INT DEFAULT NULL, + BaseMask INT DEFAULT NULL, + Material TINYINT DEFAULT NULL, + ScriptAccessPin INT DEFAULT NULL, + TextureAnimation BLOB, + ParticleSystem BLOB, + ClickAction TINYINT DEFAULT NULL, + Color INT DEFAULT NULL, + PositionX DOUBLE DEFAULT NULL, + PositionY DOUBLE DEFAULT NULL, + PositionZ DOUBLE DEFAULT NULL, + GroupPositionX DOUBLE DEFAULT NULL, + GroupPositionY DOUBLE DEFAULT NULL, + GroupPositionZ DOUBLE DEFAULT NULL, + VelocityX DOUBLE DEFAULT NULL, + VelocityY DOUBLE DEFAULT NULL, + VelocityZ DOUBLE DEFAULT NULL, + AngularVelocityX DOUBLE DEFAULT NULL, + AngularVelocityY DOUBLE DEFAULT NULL, + AngularVelocityZ DOUBLE DEFAULT NULL, + AccelerationX DOUBLE DEFAULT NULL, + AccelerationY DOUBLE DEFAULT NULL, + AccelerationZ DOUBLE DEFAULT NULL, + RotationX DOUBLE DEFAULT NULL, + RotationY DOUBLE DEFAULT NULL, + RotationZ DOUBLE DEFAULT NULL, + RotationW DOUBLE DEFAULT NULL, + SitTargetOffsetX DOUBLE DEFAULT NULL, + SitTargetOffsetY DOUBLE DEFAULT NULL, + SitTargetOffsetZ DOUBLE DEFAULT NULL, + SitTargetOrientW DOUBLE DEFAULT NULL, + SitTargetOrientX DOUBLE DEFAULT NULL, + SitTargetOrientY DOUBLE DEFAULT NULL, + SitTargetOrientZ DOUBLE DEFAULT NULL, + -- this is the shape + Shape INT DEFAULT NULL, + ScaleX DOUBLE DEFAULT NULL, + ScaleY DOUBLE DEFAULT NULL, + ScaleZ DOUBLE DEFAULT NULL, + PCode INT DEFAULT NULL, + PathBegin INT DEFAULT NULL, + PathEnd INT DEFAULT NULL, + PathScaleX INT DEFAULT NULL, + PathScaleY INT DEFAULT NULL, + PathShearX INT DEFAULT NULL, + PathShearY INT DEFAULT NULL, + PathSkew INT DEFAULT NULL, + PathCurve INT DEFAULT NULL, + PathRadiusOffset INT DEFAULT NULL, + PathRevolutions INT DEFAULT NULL, + PathTaperX INT DEFAULT NULL, + PathTaperY INT DEFAULT NULL, + PathTwist INT DEFAULT NULL, + PathTwistBegin INT DEFAULT NULL, + ProfileBegin INT DEFAULT NULL, + ProfileEnd INT DEFAULT NULL, + ProfileCurve INT DEFAULT NULL, + ProfileHollow INT DEFAULT NULL, + State INT DEFAULT NULL, + Texture BLOB, + ExtraParams BLOB, + PRIMARY KEY (UUID) ); -create table Terrain ( - RegionID TEXT not null, - MapData BLOB, - primary key (RegionID) + +CREATE INDEX PrimsRegionIdIndex ON Prims (RegionID); +CREATE INDEX PrimsRegionParentUuidIndex ON Prims (ParentUUID); + +CREATE TABLE Terrain ( + RegionID VARCHAR(36) NOT NULL, + MapData BLOB, + PRIMARY KEY (RegionID) ); -create table PrimItems ( - ItemID TEXT not null, - PrimID TEXT, - AssetID TEXT, - ParentFolderID TEXT, - CreatorID TEXT, - OwnerID TEXT, - GroupID TEXT, - LastOwnerID TEXT, - CurrentPermissions INTEGER, - BasePermissions INTEGER, - EveryonePermissions INTEGER, - GroupPermissions INTEGER, - NextPermissions INTEGER, - Name TEXT, - Description TEXT, - CreationDate INTEGER, - Flags INTEGER, - InvType INTEGER, - primary key (ItemID) + +CREATE TABLE PrimItems ( + ItemID VARCHAR(36) NOT NULL, + GroupID VARCHAR(36) DEFAULT NULL, + PrimID VARCHAR(36) DEFAULT NULL, + ParentFolderID VARCHAR(36) DEFAULT NULL, + AssetID VARCHAR(36) DEFAULT NULL, + OwnerID VARCHAR(36) DEFAULT NULL, + LastOwnerID VARCHAR(36) DEFAULT NULL, + CreatorID VARCHAR(36) DEFAULT NULL, + CreationDate BIGINT DEFAULT NULL, + InvType INT DEFAULT NULL, + Name VARCHAR(255) DEFAULT NULL, + Description VARCHAR(255) DEFAULT NULL, + NextPermissions INT DEFAULT NULL, + CurrentPermissions INT DEFAULT NULL, + BasePermissions INT DEFAULT NULL, + EveryonePermissions INT DEFAULT NULL, + GroupPermissions INT DEFAULT NULL, + Flags INT DEFAULT NULL, + PRIMARY KEY (ItemID) ); +CREATE INDEX PrimItemsPrimIdIndex ON PrimItems (PrimID); + CREATE TABLE RegionSettings ( - RegionID TEXT not null, - BlockTerraform BIT, - BlockFly BIT, - AllowDamage BIT, - RestrictPushing BIT, - AllowLandResell BIT, - AllowLandJoinDivide BIT, - BlockShowInSearch BIT, - AgentLimit INTEGER, - ObjectBonus NUMERIC, - Maturity INTEGER, - DisableScripts BIT, - DisableCollisions BIT, - DisablePhysics BIT, - TerrainTexture1 TEXT, - TerrainTexture2 TEXT, - TerrainTexture3 TEXT, - TerrainTexture4 TEXT, - Elevation1NW NUMERIC, - Elevation2NW NUMERIC, - Elevation1NE NUMERIC, - Elevation2NE NUMERIC, - Elevation1SE NUMERIC, - Elevation2SE NUMERIC, - Elevation1SW NUMERIC, - Elevation2SW NUMERIC, - WaterHeight NUMERIC, - TerrainRaiseLimit NUMERIC, - TerrainLowerLimit NUMERIC, - UseEstateSun BIT, - Sandbox BIT, - SunVectorX NUMERIC, - SunVectorY NUMERIC, - SunVectorZ NUMERIC, - FixedSun BIT, - SunPosition NUMERIC, - Covenant TEXT, - primary key (RegionID) -); + RegionID VARCHAR(36) NOT NULL, + + BlockTerraform BIT DEFAULT NULL, + BlockFly BIT DEFAULT NULL, + AllowDamage BIT DEFAULT NULL, + RestrictPushing BIT DEFAULT NULL, + AllowLandResell BIT DEFAULT NULL, + AllowLandJoinDivide BIT DEFAULT NULL, + BlockShowInSearch BIT DEFAULT NULL, + + AgentLimit INT DEFAULT NULL, + ObjectBonus DOUBLE DEFAULT NULL, + Maturity INT DEFAULT NULL, + + DisableScripts BIT DEFAULT NULL, + DisableCollisions BIT DEFAULT NULL, + DisablePhysics BIT DEFAULT NULL, + + TerrainTexture1 VARCHAR(36) DEFAULT NULL, + TerrainTexture2 VARCHAR(36) DEFAULT NULL, + TerrainTexture3 VARCHAR(36) DEFAULT NULL, + TerrainTexture4 VARCHAR(36) DEFAULT NULL, + + Elevation1NW DOUBLE DEFAULT NULL, + Elevation2NW DOUBLE DEFAULT NULL, + Elevation1NE DOUBLE DEFAULT NULL, + Elevation2NE DOUBLE DEFAULT NULL, + Elevation1SE DOUBLE DEFAULT NULL, + Elevation2SE DOUBLE DEFAULT NULL, + Elevation1SW DOUBLE DEFAULT NULL, + Elevation2SW DOUBLE DEFAULT NULL, + + WaterHeight DOUBLE DEFAULT NULL, + TerrainRaiseLimit DOUBLE DEFAULT NULL, + TerrainLowerLimit DOUBLE DEFAULT NULL, -COMMIT; + UseEstateSun BIT DEFAULT NULL, + Sandbox BIT DEFAULT NULL, + + SunVectorX DOUBLE DEFAULT NULL, + SunVectorY DOUBLE DEFAULT NULL, + SunVectorZ DOUBLE DEFAULT NULL, + + FixedSun BIT DEFAULT NULL, + SunPosition DOUBLE DEFAULT NULL, + + Covenant VARCHAR(36) DEFAULT NULL, + + PRIMARY KEY (RegionID) +); diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql index c5e42d5..6084886 100644 --- a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql @@ -1,108 +1,104 @@ -BEGIN TRANSACTION; - -create table UserAgents ( - ProfileID TEXT not null, - AgentIP TEXT, - AgentPort INTEGER, - AgentOnline INTEGER, - SessionID TEXT, - SecureSessionID TEXT, - InitialRegion TEXT, - Region TEXT, - LoginTime INTEGER, - LogoutTime INTEGER, - Handle INTEGER, - PositionX NUMERIC, - PositionY NUMERIC, - PositionZ NUMERIC, - LookAtX NUMERIC, - LookAtY NUMERIC, - LookAtZ NUMERIC, - primary key (ProfileID) +CREATE TABLE UserAgents ( + ProfileID VARCHAR(36) NOT NULL, + AgentIP VARCHAR(24) DEFAULT NULL, + AgentPort INT DEFAULT NULL, + AgentOnline BIT DEFAULT NULL, + SessionID VARCHAR(36) DEFAULT NULL, + SecureSessionID VARCHAR(36) DEFAULT NULL, + InitialRegion VARCHAR(255) DEFAULT NULL, + Region VARCHAR(255) DEFAULT NULL, + LoginTime INT DEFAULT NULL, + LogoutTime INT DEFAULT NULL, + Handle BIGINT DEFAULT NULL, + PositionX DOUBLE DEFAULT NULL, + PositionY DOUBLE DEFAULT NULL, + PositionZ DOUBLE DEFAULT NULL, + LookAtX DOUBLE DEFAULT NULL, + LookAtY DOUBLE DEFAULT NULL, + LookAtZ DOUBLE DEFAULT NULL, + PRIMARY KEY (ProfileID) ); -create table UserProfiles ( - ID TEXT not null, - WebLoginKey TEXT, - FirstName TEXT, - SurName TEXT, - Email TEXT, - PasswordHash TEXT, - PasswordSalt TEXT, - HomeRegionID TEXT, - HomeRegionX INTEGER, - HomeRegionY INTEGER, - HomeLocationX NUMERIC, - HomeLocationY NUMERIC, - HomeLocationZ NUMERIC, - HomeLookAtX NUMERIC, - HomeLookAtY NUMERIC, - HomeLookAtZ NUMERIC, - Created INTEGER, - LastLogin INTEGER, - UserInventoryURI TEXT, - UserAssetURI TEXT, - Image TEXT, - FirstLifeImage TEXT, - AboutText TEXT, - FirstLifeAboutText TEXT, - RootInventoryFolderID TEXT, - `CanDoMask` INTEGER, - `WantDoMask` INTEGER, - `UserFlags` INTEGER, - `GodLevel` INTEGER, - `CustomType` TEXT, - `Partner` TEXT, - primary key (ID) +CREATE TABLE UserProfiles ( + ID VARCHAR(36) NOT NULL, + WebLoginKey VARCHAR(36) DEFAULT NULL, + FirstName VARCHAR(32) DEFAULT NULL, + SurName VARCHAR(32) DEFAULT NULL, + Email VARCHAR(250) DEFAULT NULL, + PasswordHash VARCHAR(32) DEFAULT NULL, + PasswordSalt VARCHAR(32) DEFAULT NULL, + HomeRegionID VARCHAR(36) DEFAULT NULL, + HomeRegionX INT DEFAULT NULL, + HomeRegionY INT DEFAULT NULL, + HomeLocationX DOUBLE DEFAULT NULL, + HomeLocationY DOUBLE DEFAULT NULL, + HomeLocationZ DOUBLE DEFAULT NULL, + HomeLookAtX DOUBLE DEFAULT NULL, + HomeLookAtY DOUBLE DEFAULT NULL, + HomeLookAtZ DOUBLE DEFAULT NULL, + Created INT DEFAULT NULL, + LastLogin INT DEFAULT NULL, + UserInventoryURI VARCHAR(255) DEFAULT NULL, + UserAssetURI VARCHAR(255) DEFAULT NULL, + Image VARCHAR(36) DEFAULT NULL, + FirstLifeImage VARCHAR(36) DEFAULT NULL, + AboutText TEXT DEFAULT NULL, + FirstLifeAboutText TEXT DEFAULT NULL, + CanDoMask INT DEFAULT NULL, + WantDoMask INT DEFAULT NULL, + UserFlags INT DEFAULT NULL, + GodLevel INT DEFAULT NULL, + CustomType VARCHAR(32) DEFAULT NULL, + Partner VARCHAR(36) DEFAULT NULL, + RootInventoryFolderID VARCHAR(36) DEFAULT NULL, + PRIMARY KEY (ID) ); -create table UserAppearances ( - Owner TEXT not null, - BodyItem TEXT, - BodyAsset TEXT, - SkinItem TEXT, - SkinAsset TEXT, - HairItem TEXT, - HairAsset TEXT, - EyesItem TEXT, - EyesAsset TEXT, - ShirtItem TEXT, - ShirtAsset TEXT, - PantsItem TEXT, - PantsAsset TEXT, - ShoesItem TEXT, - ShoesAsset TEXT, - SocksItem TEXT, - SocksAsset TEXT, - JacketItem TEXT, - JacketAsset TEXT, - GlovesItem TEXT, - GlovesAsset TEXT, - UnderShirtItem TEXT, - UnderShirtAsset TEXT, - UnderPantsItem TEXT, - UnderPantsAsset TEXT, - SkirtItem TEXT, - SkirtAsset TEXT, - Texture BLOB, - VisualParams BLOB, - Serial INTEGER, - AvatarHeight NUMERIC, - primary key (Owner) -); +CREATE INDEX UserSurnameIndex ON UserProfiles (SurName); +CREATE INDEX UserFirstNameIndex ON UserProfiles (FirstName); +CREATE UNIQUE INDEX UserFullNameIndex ON UserProfiles (SurName,FirstName); +CREATE TABLE UserAppearances ( + Owner VARCHAR(36) NOT NULL, + BodyItem VARCHAR(36) DEFAULT NULL, + BodyAsset VARCHAR(36) DEFAULT NULL, + SkinItem VARCHAR(36) DEFAULT NULL, + SkinAsset VARCHAR(36) DEFAULT NULL, + HairItem VARCHAR(36) DEFAULT NULL, + HairAsset VARCHAR(36) DEFAULT NULL, + EyesItem VARCHAR(36) DEFAULT NULL, + EyesAsset VARCHAR(36) DEFAULT NULL, + ShirtItem VARCHAR(36) DEFAULT NULL, + ShirtAsset VARCHAR(36) DEFAULT NULL, + PantsItem VARCHAR(36) DEFAULT NULL, + PantsAsset VARCHAR(36) DEFAULT NULL, + ShoesItem VARCHAR(36) DEFAULT NULL, + ShoesAsset VARCHAR(36) DEFAULT NULL, + SocksItem VARCHAR(36) DEFAULT NULL, + SocksAsset VARCHAR(36) DEFAULT NULL, + JacketItem VARCHAR(36) DEFAULT NULL, + JacketAsset VARCHAR(36) DEFAULT NULL, + GlovesItem VARCHAR(36) DEFAULT NULL, + GlovesAsset VARCHAR(36) DEFAULT NULL, + UnderShirtItem VARCHAR(36) DEFAULT NULL, + UnderShirtAsset VARCHAR(36) DEFAULT NULL, + UnderPantsItem VARCHAR(36) DEFAULT NULL, + UnderPantsAsset VARCHAR(36) DEFAULT NULL, + SkirtItem VARCHAR(36) DEFAULT NULL, + SkirtAsset VARCHAR(36) DEFAULT NULL, + Texture BLOB, + VisualParams BLOB, + Serial INT DEFAULT NULL, + AvatarHeight FLOAT DEFAULT NULL, + PRIMARY KEY (Owner) +); CREATE TABLE UserFriends ( - UserFriendID TEXT, - OwnerID TEXT, - FriendID TEXT, - FriendPermissions INTEGER, - primary key (UserFriendID) + UserFriendID VARCHAR(36) NOT NULL, + OwnerID VARCHAR(36) DEFAULT NULL, + FriendID VARCHAR(36) DEFAULT NULL, + FriendPermissions INT DEFAULT NULL, + PRIMARY KEY (UserFriendID) ); -create index UserFirstNameIndex on UserProfiles (FirstName); -create index UserSurnameIndex on UserProfiles (SurName); -create unique index UserFullNameIndex on UserProfiles (FirstName,SurName); -create unique index UserFriendsOwnerFriendIndex on UserFriends (OwnerID,FriendID); - -COMMIT; +CREATE UNIQUE INDEX UserFriendsOwnerIdFriendIdIndex ON UserFriends (OwnerID,FriendID); -- cgit v1.1