:VERSION 1

CREATE TABLE [dbo].[prims](
	[UUID] [varchar](255) NOT NULL,
	[RegionUUID] [varchar](255) NULL,
	[ParentID] [int] NULL,
	[CreationDate] [int] NULL,
	[Name] [varchar](255) NULL,
	[SceneGroupID] [varchar](255) NULL,
	[Text] [varchar](255) NULL,
	[Description] [varchar](255) NULL,
	[SitName] [varchar](255) NULL,
	[TouchName] [varchar](255) NULL,
	[ObjectFlags] [int] NULL,
	[CreatorID] [varchar](255) NULL,
	[OwnerID] [varchar](255) NULL,
	[GroupID] [varchar](255) NULL,
	[LastOwnerID] [varchar](255) NULL,
	[OwnerMask] [int] NULL,
	[NextOwnerMask] [int] NULL,
	[GroupMask] [int] NULL,
	[EveryoneMask] [int] NULL,
	[BaseMask] [int] NULL,
	[PositionX] [float] NULL,
	[PositionY] [float] NULL,
	[PositionZ] [float] NULL,
	[GroupPositionX] [float] NULL,
	[GroupPositionY] [float] NULL,
	[GroupPositionZ] [float] NULL,
	[VelocityX] [float] NULL,
	[VelocityY] [float] NULL,
	[VelocityZ] [float] NULL,
	[AngularVelocityX] [float] NULL,
	[AngularVelocityY] [float] NULL,
	[AngularVelocityZ] [float] NULL,
	[AccelerationX] [float] NULL,
	[AccelerationY] [float] NULL,
	[AccelerationZ] [float] NULL,
	[RotationX] [float] NULL,
	[RotationY] [float] NULL,
	[RotationZ] [float] NULL,
	[RotationW] [float] NULL,
	[SitTargetOffsetX] [float] NULL,
	[SitTargetOffsetY] [float] NULL,
	[SitTargetOffsetZ] [float] NULL,
	[SitTargetOrientW] [float] NULL,
	[SitTargetOrientX] [float] NULL,
	[SitTargetOrientY] [float] NULL,
	[SitTargetOrientZ] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[UUID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[primshapes](
	[UUID] [varchar](255) NOT NULL,
	[Shape] [int] NULL,
	[ScaleX] [float] NULL,
	[ScaleY] [float] NULL,
	[ScaleZ] [float] NULL,
	[PCode] [int] NULL,
	[PathBegin] [int] NULL,
	[PathEnd] [int] NULL,
	[PathScaleX] [int] NULL,
	[PathScaleY] [int] NULL,
	[PathShearX] [int] NULL,
	[PathShearY] [int] NULL,
	[PathSkew] [int] NULL,
	[PathCurve] [int] NULL,
	[PathRadiusOffset] [int] NULL,
	[PathRevolutions] [int] NULL,
	[PathTaperX] [int] NULL,
	[PathTaperY] [int] NULL,
	[PathTwist] [int] NULL,
	[PathTwistBegin] [int] NULL,
	[ProfileBegin] [int] NULL,
	[ProfileEnd] [int] NULL,
	[ProfileCurve] [int] NULL,
	[ProfileHollow] [int] NULL,
	[State] [int] NULL,
	[Texture] [image] NULL,
	[ExtraParams] [image] NULL,
PRIMARY KEY CLUSTERED 
(
	[UUID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

CREATE TABLE [dbo].[primitems](
	[itemID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
	[primID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[assetID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[parentFolderID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[invType] [int] NULL,
	[assetType] [int] NULL,
	[name] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[description] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[creationDate] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[creatorID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[ownerID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[lastOwnerID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[groupID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[nextPermissions] [int] NULL,
	[currentPermissions] [int] NULL,
	[basePermissions] [int] NULL,
	[everyonePermissions] [int] NULL,
	[groupPermissions] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[itemID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[terrain](
	[RegionUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Revision] [int] NULL,
	[Heightfield] [image] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

CREATE TABLE [dbo].[land](
	[UUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
	[RegionUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[LocalLandID] [int] NULL,
	[Bitmap] [image] NULL,
	[Name] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Description] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[OwnerUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[IsGroupOwned] [int] NULL,
	[Area] [int] NULL,
	[AuctionID] [int] NULL,
	[Category] [int] NULL,
	[ClaimDate] [int] NULL,
	[ClaimPrice] [int] NULL,
	[GroupUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[SalePrice] [int] NULL,
	[LandStatus] [int] NULL,
	[LandFlags] [int] NULL,
	[LandingType] [int] NULL,
	[MediaAutoScale] [int] NULL,
	[MediaTextureUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[MediaURL] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[MusicURL] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[PassHours] [float] NULL,
	[PassPrice] [int] NULL,
	[SnapshotUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[UserLocationX] [float] NULL,
	[UserLocationY] [float] NULL,
	[UserLocationZ] [float] NULL,
	[UserLookAtX] [float] NULL,
	[UserLookAtY] [float] NULL,
	[UserLookAtZ] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[UUID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

CREATE TABLE [dbo].[landaccesslist](
	[LandUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[AccessUUID] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Flags] [int] NULL
) ON [PRIMARY]

:VERSION 2

BEGIN TRANSACTION

CREATE TABLE regionban (
	[regionUUID] VARCHAR(36) NOT NULL, 
	[bannedUUID] VARCHAR(36) NOT NULL, 
	[bannedIp] VARCHAR(16) NOT NULL, 
	[bannedIpHostMask] VARCHAR(16) NOT NULL)

create table [dbo].[regionsettings] (
	[regionUUID] [varchar](36) not null,
	[block_terraform] [bit] not null,
	[block_fly] [bit] not null,
	[allow_damage] [bit] not null,
	[restrict_pushing] [bit] not null,
	[allow_land_resell] [bit] not null,
	[allow_land_join_divide] [bit] not null,
	[block_show_in_search] [bit] not null,
	[agent_limit] [int] not null,
	[object_bonus] [float] not null,
	[maturity] [int] not null,
	[disable_scripts] [bit] not null,
	[disable_collisions] [bit] not null,
	[disable_physics] [bit] not null,
	[terrain_texture_1] [varchar](36) not null,
	[terrain_texture_2] [varchar](36) not null,
	[terrain_texture_3] [varchar](36) not null,
	[terrain_texture_4] [varchar](36) not null,
	[elevation_1_nw] [float] not null,
	[elevation_2_nw] [float] not null,
	[elevation_1_ne] [float] not null,
	[elevation_2_ne] [float] not null,
	[elevation_1_se] [float] not null,
	[elevation_2_se] [float] not null,
	[elevation_1_sw] [float] not null,
	[elevation_2_sw] [float] not null,
	[water_height] [float] not null,
	[terrain_raise_limit] [float] not null,
	[terrain_lower_limit] [float] not null,
	[use_estate_sun] [bit] not null,
	[fixed_sun] [bit] not null,
	[sun_position] [float] not null,
	[covenant] [varchar](36) default NULL,
	[Sandbox] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[regionUUID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

COMMIT

:VERSION 3

BEGIN TRANSACTION

CREATE TABLE dbo.Tmp_prims
	(
	UUID varchar(36) NOT NULL,
	RegionUUID varchar(36) NULL,
	ParentID int NULL,
	CreationDate int NULL,
	Name varchar(255) NULL,
	SceneGroupID varchar(36) NULL,
	Text varchar(255) NULL,
	Description varchar(255) NULL,
	SitName varchar(255) NULL,
	TouchName varchar(255) NULL,
	ObjectFlags int NULL,
	CreatorID varchar(36) NULL,
	OwnerID varchar(36) NULL,
	GroupID varchar(36) NULL,
	LastOwnerID varchar(36) NULL,
	OwnerMask int NULL,
	NextOwnerMask int NULL,
	GroupMask int NULL,
	EveryoneMask int NULL,
	BaseMask int NULL,
	PositionX float(53) NULL,
	PositionY float(53) NULL,
	PositionZ float(53) NULL,
	GroupPositionX float(53) NULL,
	GroupPositionY float(53) NULL,
	GroupPositionZ float(53) NULL,
	VelocityX float(53) NULL,
	VelocityY float(53) NULL,
	VelocityZ float(53) NULL,
	AngularVelocityX float(53) NULL,
	AngularVelocityY float(53) NULL,
	AngularVelocityZ float(53) NULL,
	AccelerationX float(53) NULL,
	AccelerationY float(53) NULL,
	AccelerationZ float(53) NULL,
	RotationX float(53) NULL,
	RotationY float(53) NULL,
	RotationZ float(53) NULL,
	RotationW float(53) NULL,
	SitTargetOffsetX float(53) NULL,
	SitTargetOffsetY float(53) NULL,
	SitTargetOffsetZ float(53) NULL,
	SitTargetOrientW float(53) NULL,
	SitTargetOrientX float(53) NULL,
	SitTargetOrientY float(53) NULL,
	SitTargetOrientZ float(53) NULL
	)  ON [PRIMARY]

IF EXISTS(SELECT * FROM dbo.prims)
	 EXEC('INSERT INTO dbo.Tmp_prims (UUID, RegionUUID, ParentID, CreationDate, Name, SceneGroupID, Text, Description, SitName, TouchName, ObjectFlags, CreatorID, OwnerID, GroupID, LastOwnerID, OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ)
		SELECT CONVERT(varchar(36), UUID), CONVERT(varchar(36), RegionUUID), ParentID, CreationDate, Name, CONVERT(varchar(36), SceneGroupID), Text, Description, SitName, TouchName, ObjectFlags, CONVERT(varchar(36), CreatorID), CONVERT(varchar(36), OwnerID), CONVERT(varchar(36), GroupID), CONVERT(varchar(36), LastOwnerID), OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ FROM dbo.prims WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.prims

EXECUTE sp_rename N'dbo.Tmp_prims', N'prims', 'OBJECT' 

ALTER TABLE dbo.prims ADD CONSTRAINT
	PK__prims__10566F31 PRIMARY KEY CLUSTERED 
	(
	UUID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

COMMIT

:VERSION 4

BEGIN TRANSACTION

CREATE TABLE Tmp_primitems
	(
	itemID varchar(36) NOT NULL,
	primID varchar(36) NULL,
	assetID varchar(36) NULL,
	parentFolderID varchar(36) NULL,
	invType int NULL,
	assetType int NULL,
	name varchar(255) NULL,
	description varchar(255) NULL,
	creationDate varchar(255) NULL,
	creatorID varchar(36) NULL,
	ownerID varchar(36) NULL,
	lastOwnerID varchar(36) NULL,
	groupID varchar(36) NULL,
	nextPermissions int NULL,
	currentPermissions int NULL,
	basePermissions int NULL,
	everyonePermissions int NULL,
	groupPermissions int NULL
	)  ON [PRIMARY]

IF EXISTS(SELECT * FROM primitems)
	 EXEC('INSERT INTO Tmp_primitems (itemID, primID, assetID, parentFolderID, invType, assetType, name, description, creationDate, creatorID, ownerID, lastOwnerID, groupID, nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions)
		SELECT CONVERT(varchar(36), itemID), CONVERT(varchar(36), primID), CONVERT(varchar(36), assetID), CONVERT(varchar(36), parentFolderID), invType, assetType, name, description, creationDate, CONVERT(varchar(36), creatorID), CONVERT(varchar(36), ownerID), CONVERT(varchar(36), lastOwnerID), CONVERT(varchar(36), groupID), nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions')

DROP TABLE primitems

EXECUTE sp_rename N'Tmp_primitems', N'primitems', 'OBJECT' 

ALTER TABLE primitems ADD CONSTRAINT
	PK__primitems__0A688BB1 PRIMARY KEY CLUSTERED 
	(
	itemID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]


COMMIT


:VERSION 5

BEGIN TRANSACTION

CREATE TABLE Tmp_primshapes
	(
	UUID varchar(36) NOT NULL,
	Shape int NULL,
	ScaleX float(53) NULL,
	ScaleY float(53) NULL,
	ScaleZ float(53) NULL,
	PCode int NULL,
	PathBegin int NULL,
	PathEnd int NULL,
	PathScaleX int NULL,
	PathScaleY int NULL,
	PathShearX int NULL,
	PathShearY int NULL,
	PathSkew int NULL,
	PathCurve int NULL,
	PathRadiusOffset int NULL,
	PathRevolutions int NULL,
	PathTaperX int NULL,
	PathTaperY int NULL,
	PathTwist int NULL,
	PathTwistBegin int NULL,
	ProfileBegin int NULL,
	ProfileEnd int NULL,
	ProfileCurve int NULL,
	ProfileHollow int NULL,
	State int NULL,
	Texture image NULL,
	ExtraParams image NULL
	)  ON [PRIMARY]
	 TEXTIMAGE_ON [PRIMARY]

IF EXISTS(SELECT * FROM primshapes)
	 EXEC('INSERT INTO Tmp_primshapes (UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams)
		SELECT CONVERT(varchar(36), UUID), Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams FROM primshapes WITH (HOLDLOCK TABLOCKX)')

DROP TABLE primshapes

EXECUTE sp_rename N'Tmp_primshapes', N'primshapes', 'OBJECT' 

ALTER TABLE primshapes ADD CONSTRAINT
	PK__primshapes__0880433F PRIMARY KEY CLUSTERED 
	(
	UUID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

COMMIT


:VERSION 6

BEGIN TRANSACTION

ALTER TABLE prims ADD PayPrice int not null default 0
ALTER TABLE prims ADD PayButton1 int not null default 0
ALTER TABLE prims ADD PayButton2 int not null default 0
ALTER TABLE prims ADD PayButton3 int not null default 0
ALTER TABLE prims ADD PayButton4 int not null default 0
ALTER TABLE prims ADD LoopedSound varchar(36) not null default '00000000-0000-0000-0000-000000000000';
ALTER TABLE prims ADD LoopedSoundGain float not null default 0.0;
ALTER TABLE prims ADD TextureAnimation image
ALTER TABLE prims ADD OmegaX float not null default 0.0
ALTER TABLE prims ADD OmegaY float not null default 0.0
ALTER TABLE prims ADD OmegaZ float not null default 0.0
ALTER TABLE prims ADD CameraEyeOffsetX float not null default 0.0
ALTER TABLE prims ADD CameraEyeOffsetY float not null default 0.0
ALTER TABLE prims ADD CameraEyeOffsetZ float not null default 0.0
ALTER TABLE prims ADD CameraAtOffsetX float not null default 0.0
ALTER TABLE prims ADD CameraAtOffsetY float not null default 0.0
ALTER TABLE prims ADD CameraAtOffsetZ float not null default 0.0
ALTER TABLE prims ADD ForceMouselook tinyint not null default 0
ALTER TABLE prims ADD ScriptAccessPin int not null default 0
ALTER TABLE prims ADD AllowedDrop tinyint not null default 0
ALTER TABLE prims ADD DieAtEdge tinyint not null default 0
ALTER TABLE prims ADD SalePrice int not null default 10
ALTER TABLE prims ADD SaleType tinyint not null default 0

ALTER TABLE primitems add flags integer not null default 0

ALTER TABLE land ADD AuthbuyerID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'

CREATE index prims_regionuuid on prims(RegionUUID)
CREATE index prims_parentid on prims(ParentID)

CREATE index primitems_primid on primitems(primID)

COMMIT


:VERSION 7

BEGIN TRANSACTION

ALTER TABLE prims ADD ColorR int not null default 0;
ALTER TABLE prims ADD ColorG int not null default 0;
ALTER TABLE prims ADD ColorB int not null default 0;
ALTER TABLE prims ADD ColorA int not null default 0;
ALTER TABLE prims ADD ParticleSystem IMAGE;
ALTER TABLE prims ADD ClickAction tinyint NOT NULL default 0;

COMMIT


:VERSION 8

BEGIN TRANSACTION

ALTER TABLE land ADD OtherCleanTime integer NOT NULL default 0;
ALTER TABLE land ADD Dwell integer NOT NULL default 0;

COMMIT

:VERSION 9

BEGIN TRANSACTION

ALTER TABLE prims ADD Material tinyint NOT NULL default 3

COMMIT


:VERSION 10

BEGIN TRANSACTION

ALTER TABLE regionsettings ADD sunvectorx float NOT NULL default 0;
ALTER TABLE regionsettings ADD sunvectory float NOT NULL default 0;
ALTER TABLE regionsettings ADD sunvectorz float NOT NULL default 0;

COMMIT


:VERSION 11

BEGIN TRANSACTION

ALTER TABLE prims ADD CollisionSound char(36) not null default '00000000-0000-0000-0000-000000000000'
ALTER TABLE prims ADD CollisionSoundVolume float not null default 0.0

COMMIT


:VERSION 12

BEGIN TRANSACTION

ALTER TABLE prims ADD LinkNumber integer not null default 0

COMMIT


:VERSION 13

BEGIN TRANSACTION

CREATE TABLE dbo.Tmp_prims
	(
	UUID uniqueidentifier NOT NULL,
	RegionUUID uniqueidentifier NULL,
	ParentID int NULL,
	CreationDate int NULL,
	Name varchar(255) NULL,
	SceneGroupID uniqueidentifier NULL,
	Text varchar(255) NULL,
	Description varchar(255) NULL,
	SitName varchar(255) NULL,
	TouchName varchar(255) NULL,
	ObjectFlags int NULL,
	CreatorID uniqueidentifier NULL,
	OwnerID uniqueidentifier NULL,
	GroupID uniqueidentifier NULL,
	LastOwnerID uniqueidentifier NULL,
	OwnerMask int NULL,
	NextOwnerMask int NULL,
	GroupMask int NULL,
	EveryoneMask int NULL,
	BaseMask int NULL,
	PositionX float(53) NULL,
	PositionY float(53) NULL,
	PositionZ float(53) NULL,
	GroupPositionX float(53) NULL,
	GroupPositionY float(53) NULL,
	GroupPositionZ float(53) NULL,
	VelocityX float(53) NULL,
	VelocityY float(53) NULL,
	VelocityZ float(53) NULL,
	AngularVelocityX float(53) NULL,
	AngularVelocityY float(53) NULL,
	AngularVelocityZ float(53) NULL,
	AccelerationX float(53) NULL,
	AccelerationY float(53) NULL,
	AccelerationZ float(53) NULL,
	RotationX float(53) NULL,
	RotationY float(53) NULL,
	RotationZ float(53) NULL,
	RotationW float(53) NULL,
	SitTargetOffsetX float(53) NULL,
	SitTargetOffsetY float(53) NULL,
	SitTargetOffsetZ float(53) NULL,
	SitTargetOrientW float(53) NULL,
	SitTargetOrientX float(53) NULL,
	SitTargetOrientY float(53) NULL,
	SitTargetOrientZ float(53) NULL,
	PayPrice int NOT NULL DEFAULT ((0)),
	PayButton1 int NOT NULL DEFAULT ((0)),
	PayButton2 int NOT NULL DEFAULT ((0)),
	PayButton3 int NOT NULL DEFAULT ((0)),
	PayButton4 int NOT NULL DEFAULT ((0)),
	LoopedSound uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
	LoopedSoundGain float(53) NOT NULL DEFAULT ((0.0)),
	TextureAnimation image NULL,
	OmegaX float(53) NOT NULL DEFAULT ((0.0)),
	OmegaY float(53) NOT NULL DEFAULT ((0.0)),
	OmegaZ float(53) NOT NULL DEFAULT ((0.0)),
	CameraEyeOffsetX float(53) NOT NULL DEFAULT ((0.0)),
	CameraEyeOffsetY float(53) NOT NULL DEFAULT ((0.0)),
	CameraEyeOffsetZ float(53) NOT NULL DEFAULT ((0.0)),
	CameraAtOffsetX float(53) NOT NULL DEFAULT ((0.0)),
	CameraAtOffsetY float(53) NOT NULL DEFAULT ((0.0)),
	CameraAtOffsetZ float(53) NOT NULL DEFAULT ((0.0)),
	ForceMouselook tinyint NOT NULL DEFAULT ((0)),
	ScriptAccessPin int NOT NULL DEFAULT ((0)),
	AllowedDrop tinyint NOT NULL DEFAULT ((0)),
	DieAtEdge tinyint NOT NULL DEFAULT ((0)),
	SalePrice int NOT NULL DEFAULT ((10)),
	SaleType tinyint NOT NULL DEFAULT ((0)),
	ColorR int NOT NULL DEFAULT ((0)),
	ColorG int NOT NULL DEFAULT ((0)),
	ColorB int NOT NULL DEFAULT ((0)),
	ColorA int NOT NULL DEFAULT ((0)),
	ParticleSystem image NULL,
	ClickAction tinyint NOT NULL DEFAULT ((0)),
	Material tinyint NOT NULL DEFAULT ((3)),
	CollisionSound uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
	CollisionSoundVolume float(53) NOT NULL DEFAULT ((0.0)),
	LinkNumber int NOT NULL DEFAULT ((0))
	)  ON [PRIMARY]
	 TEXTIMAGE_ON [PRIMARY]

IF EXISTS(SELECT * FROM dbo.prims)
	 EXEC('INSERT INTO dbo.Tmp_prims (UUID, RegionUUID, ParentID, CreationDate, Name, SceneGroupID, Text, Description, SitName, TouchName, ObjectFlags, CreatorID, OwnerID, GroupID, LastOwnerID, OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX, OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, LinkNumber)
		SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, RegionUUID), ParentID, CreationDate, Name, CONVERT(uniqueidentifier, SceneGroupID), Text, Description, SitName, TouchName, ObjectFlags, CONVERT(uniqueidentifier, CreatorID), CONVERT(uniqueidentifier, OwnerID), CONVERT(uniqueidentifier, GroupID), CONVERT(uniqueidentifier, LastOwnerID), OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, CONVERT(uniqueidentifier, LoopedSound), LoopedSoundGain, TextureAnimation, OmegaX, OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, ParticleSystem, ClickAction, Material, CONVERT(uniqueidentifier, CollisionSound), CollisionSoundVolume, LinkNumber FROM dbo.prims WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.prims

EXECUTE sp_rename N'dbo.Tmp_prims', N'prims', 'OBJECT' 

ALTER TABLE dbo.prims ADD CONSTRAINT
	PK__prims__10566F31 PRIMARY KEY CLUSTERED 
	(
	UUID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]


CREATE NONCLUSTERED INDEX prims_regionuuid ON dbo.prims
	(
	RegionUUID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

CREATE NONCLUSTERED INDEX prims_parentid ON dbo.prims
	(
	ParentID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

COMMIT


:VERSION 14

BEGIN TRANSACTION

CREATE TABLE dbo.Tmp_primshapes
	(
	UUID uniqueidentifier NOT NULL,
	Shape int NULL,
	ScaleX float(53) NULL,
	ScaleY float(53) NULL,
	ScaleZ float(53) NULL,
	PCode int NULL,
	PathBegin int NULL,
	PathEnd int NULL,
	PathScaleX int NULL,
	PathScaleY int NULL,
	PathShearX int NULL,
	PathShearY int NULL,
	PathSkew int NULL,
	PathCurve int NULL,
	PathRadiusOffset int NULL,
	PathRevolutions int NULL,
	PathTaperX int NULL,
	PathTaperY int NULL,
	PathTwist int NULL,
	PathTwistBegin int NULL,
	ProfileBegin int NULL,
	ProfileEnd int NULL,
	ProfileCurve int NULL,
	ProfileHollow int NULL,
	State int NULL,
	Texture image NULL,
	ExtraParams image NULL
	)  ON [PRIMARY]
	 TEXTIMAGE_ON [PRIMARY]

IF EXISTS(SELECT * FROM dbo.primshapes)
	 EXEC('INSERT INTO dbo.Tmp_primshapes (UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams)
		SELECT CONVERT(uniqueidentifier, UUID), Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams FROM dbo.primshapes WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.primshapes

EXECUTE sp_rename N'dbo.Tmp_primshapes', N'primshapes', 'OBJECT' 

ALTER TABLE dbo.primshapes ADD CONSTRAINT
	PK__primshapes__0880433F PRIMARY KEY CLUSTERED 
	(
	UUID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

COMMIT


:VERSION 15

BEGIN TRANSACTION

CREATE TABLE dbo.Tmp_primitems
	(
	itemID uniqueidentifier NOT NULL,
	primID uniqueidentifier NULL,
	assetID uniqueidentifier NULL,
	parentFolderID uniqueidentifier NULL,
	invType int NULL,
	assetType int NULL,
	name varchar(255) NULL,
	description varchar(255) NULL,
	creationDate varchar(255) NULL,
	creatorID uniqueidentifier NULL,
	ownerID uniqueidentifier NULL,
	lastOwnerID uniqueidentifier NULL,
	groupID uniqueidentifier NULL,
	nextPermissions int NULL,
	currentPermissions int NULL,
	basePermissions int NULL,
	everyonePermissions int NULL,
	groupPermissions int NULL,
	flags int NOT NULL DEFAULT ((0))
	)  ON [PRIMARY]

IF EXISTS(SELECT * FROM dbo.primitems)
	 EXEC('INSERT INTO dbo.Tmp_primitems (itemID, primID, assetID, parentFolderID, invType, assetType, name, description, creationDate, creatorID, ownerID, lastOwnerID, groupID, nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions, flags)
		SELECT CONVERT(uniqueidentifier, itemID), CONVERT(uniqueidentifier, primID), CONVERT(uniqueidentifier, assetID), CONVERT(uniqueidentifier, parentFolderID), invType, assetType, name, description, creationDate, CONVERT(uniqueidentifier, creatorID), CONVERT(uniqueidentifier, ownerID), CONVERT(uniqueidentifier, lastOwnerID), CONVERT(uniqueidentifier, groupID), nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions, flags FROM dbo.primitems WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.primitems

EXECUTE sp_rename N'dbo.Tmp_primitems', N'primitems', 'OBJECT' 

ALTER TABLE dbo.primitems ADD CONSTRAINT
	PK__primitems__0A688BB1 PRIMARY KEY CLUSTERED 
	(
	itemID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

CREATE NONCLUSTERED INDEX primitems_primid ON dbo.primitems
	(
	primID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

COMMIT


:VERSION 16


BEGIN TRANSACTION

CREATE TABLE dbo.Tmp_terrain
	(
	RegionUUID uniqueidentifier NULL,
	Revision int NULL,
	Heightfield image NULL
	)  ON [PRIMARY]
	 TEXTIMAGE_ON [PRIMARY]

IF EXISTS(SELECT * FROM dbo.terrain)
	 EXEC('INSERT INTO dbo.Tmp_terrain (RegionUUID, Revision, Heightfield)
		SELECT CONVERT(uniqueidentifier, RegionUUID), Revision, Heightfield FROM dbo.terrain WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.terrain

EXECUTE sp_rename N'dbo.Tmp_terrain', N'terrain', 'OBJECT' 

COMMIT


:VERSION 17

BEGIN TRANSACTION

CREATE TABLE dbo.Tmp_land
	(
	UUID uniqueidentifier NOT NULL,
	RegionUUID uniqueidentifier NULL,
	LocalLandID int NULL,
	Bitmap image NULL,
	Name varchar(255) NULL,
	Description varchar(255) NULL,
	OwnerUUID uniqueidentifier NULL,
	IsGroupOwned int NULL,
	Area int NULL,
	AuctionID int NULL,
	Category int NULL,
	ClaimDate int NULL,
	ClaimPrice int NULL,
	GroupUUID uniqueidentifier NULL,
	SalePrice int NULL,
	LandStatus int NULL,
	LandFlags int NULL,
	LandingType int NULL,
	MediaAutoScale int NULL,
	MediaTextureUUID uniqueidentifier NULL,
	MediaURL varchar(255) NULL,
	MusicURL varchar(255) NULL,
	PassHours float(53) NULL,
	PassPrice int NULL,
	SnapshotUUID uniqueidentifier NULL,
	UserLocationX float(53) NULL,
	UserLocationY float(53) NULL,
	UserLocationZ float(53) NULL,
	UserLookAtX float(53) NULL,
	UserLookAtY float(53) NULL,
	UserLookAtZ float(53) NULL,
	AuthbuyerID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
	OtherCleanTime int NOT NULL DEFAULT ((0)),
	Dwell int NOT NULL DEFAULT ((0))
	)  ON [PRIMARY]
	 TEXTIMAGE_ON [PRIMARY]

IF EXISTS(SELECT * FROM dbo.land)
	 EXEC('INSERT INTO dbo.Tmp_land (UUID, RegionUUID, LocalLandID, Bitmap, Name, Description, OwnerUUID, IsGroupOwned, Area, AuctionID, Category, ClaimDate, ClaimPrice, GroupUUID, SalePrice, LandStatus, LandFlags, LandingType, MediaAutoScale, MediaTextureUUID, MediaURL, MusicURL, PassHours, PassPrice, SnapshotUUID, UserLocationX, UserLocationY, UserLocationZ, UserLookAtX, UserLookAtY, UserLookAtZ, AuthbuyerID, OtherCleanTime, Dwell)
		SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, RegionUUID), LocalLandID, Bitmap, Name, Description, CONVERT(uniqueidentifier, OwnerUUID), IsGroupOwned, Area, AuctionID, Category, ClaimDate, ClaimPrice, CONVERT(uniqueidentifier, GroupUUID), SalePrice, LandStatus, LandFlags, LandingType, MediaAutoScale, CONVERT(uniqueidentifier, MediaTextureUUID), MediaURL, MusicURL, PassHours, PassPrice, CONVERT(uniqueidentifier, SnapshotUUID), UserLocationX, UserLocationY, UserLocationZ, UserLookAtX, UserLookAtY, UserLookAtZ, CONVERT(uniqueidentifier, AuthbuyerID), OtherCleanTime, Dwell FROM dbo.land WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.land

EXECUTE sp_rename N'dbo.Tmp_land', N'land', 'OBJECT' 

ALTER TABLE dbo.land ADD CONSTRAINT
	PK__land__65A475E71BFD2C07 PRIMARY KEY CLUSTERED 
	(
	UUID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

COMMIT



:VERSION 18

BEGIN TRANSACTION

CREATE TABLE dbo.Tmp_landaccesslist
	(
	LandUUID uniqueidentifier NULL,
	AccessUUID uniqueidentifier NULL,
	Flags int NULL
	)  ON [PRIMARY]

IF EXISTS(SELECT * FROM dbo.landaccesslist)
	 EXEC('INSERT INTO dbo.Tmp_landaccesslist (LandUUID, AccessUUID, Flags)
		SELECT CONVERT(uniqueidentifier, LandUUID), CONVERT(uniqueidentifier, AccessUUID), Flags FROM dbo.landaccesslist WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.landaccesslist

EXECUTE sp_rename N'dbo.Tmp_landaccesslist', N'landaccesslist', 'OBJECT' 

COMMIT



:VERSION 19

BEGIN TRANSACTION

CREATE TABLE dbo.Tmp_regionban
	(
	regionUUID uniqueidentifier NOT NULL,
	bannedUUID uniqueidentifier NOT NULL,
	bannedIp varchar(16) NOT NULL,
	bannedIpHostMask varchar(16) NOT NULL
	)  ON [PRIMARY]

IF EXISTS(SELECT * FROM dbo.regionban)
	 EXEC('INSERT INTO dbo.Tmp_regionban (regionUUID, bannedUUID, bannedIp, bannedIpHostMask)
		SELECT CONVERT(uniqueidentifier, regionUUID), CONVERT(uniqueidentifier, bannedUUID), bannedIp, bannedIpHostMask FROM dbo.regionban WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.regionban

EXECUTE sp_rename N'dbo.Tmp_regionban', N'regionban', 'OBJECT' 

COMMIT


:VERSION 20

BEGIN TRANSACTION

CREATE TABLE dbo.Tmp_regionsettings
	(
	regionUUID uniqueidentifier NOT NULL,
	block_terraform bit NOT NULL,
	block_fly bit NOT NULL,
	allow_damage bit NOT NULL,
	restrict_pushing bit NOT NULL,
	allow_land_resell bit NOT NULL,
	allow_land_join_divide bit NOT NULL,
	block_show_in_search bit NOT NULL,
	agent_limit int NOT NULL,
	object_bonus float(53) NOT NULL,
	maturity int NOT NULL,
	disable_scripts bit NOT NULL,
	disable_collisions bit NOT NULL,
	disable_physics bit NOT NULL,
	terrain_texture_1 uniqueidentifier NOT NULL,
	terrain_texture_2 uniqueidentifier NOT NULL,
	terrain_texture_3 uniqueidentifier NOT NULL,
	terrain_texture_4 uniqueidentifier NOT NULL,
	elevation_1_nw float(53) NOT NULL,
	elevation_2_nw float(53) NOT NULL,
	elevation_1_ne float(53) NOT NULL,
	elevation_2_ne float(53) NOT NULL,
	elevation_1_se float(53) NOT NULL,
	elevation_2_se float(53) NOT NULL,
	elevation_1_sw float(53) NOT NULL,
	elevation_2_sw float(53) NOT NULL,
	water_height float(53) NOT NULL,
	terrain_raise_limit float(53) NOT NULL,
	terrain_lower_limit float(53) NOT NULL,
	use_estate_sun bit NOT NULL,
	fixed_sun bit NOT NULL,
	sun_position float(53) NOT NULL,
	covenant uniqueidentifier NULL DEFAULT (NULL),
	Sandbox bit NOT NULL,
	sunvectorx float(53) NOT NULL DEFAULT ((0)),
	sunvectory float(53) NOT NULL DEFAULT ((0)),
	sunvectorz float(53) NOT NULL DEFAULT ((0))
	)  ON [PRIMARY]

IF EXISTS(SELECT * FROM dbo.regionsettings)
	 EXEC('INSERT INTO dbo.Tmp_regionsettings (regionUUID, block_terraform, block_fly, allow_damage, restrict_pushing, allow_land_resell, allow_land_join_divide, block_show_in_search, agent_limit, object_bonus, maturity, disable_scripts, disable_collisions, disable_physics, terrain_texture_1, terrain_texture_2, terrain_texture_3, terrain_texture_4, elevation_1_nw, elevation_2_nw, elevation_1_ne, elevation_2_ne, elevation_1_se, elevation_2_se, elevation_1_sw, elevation_2_sw, water_height, terrain_raise_limit, terrain_lower_limit, use_estate_sun, fixed_sun, sun_position, covenant, Sandbox, sunvectorx, sunvectory, sunvectorz)
		SELECT CONVERT(uniqueidentifier, regionUUID), block_terraform, block_fly, allow_damage, restrict_pushing, allow_land_resell, allow_land_join_divide, block_show_in_search, agent_limit, object_bonus, maturity, disable_scripts, disable_collisions, disable_physics, CONVERT(uniqueidentifier, terrain_texture_1), CONVERT(uniqueidentifier, terrain_texture_2), CONVERT(uniqueidentifier, terrain_texture_3), CONVERT(uniqueidentifier, terrain_texture_4), elevation_1_nw, elevation_2_nw, elevation_1_ne, elevation_2_ne, elevation_1_se, elevation_2_se, elevation_1_sw, elevation_2_sw, water_height, terrain_raise_limit, terrain_lower_limit, use_estate_sun, fixed_sun, sun_position, CONVERT(uniqueidentifier, covenant), Sandbox, sunvectorx, sunvectory, sunvectorz FROM dbo.regionsettings WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.regionsettings

EXECUTE sp_rename N'dbo.Tmp_regionsettings', N'regionsettings', 'OBJECT' 

ALTER TABLE dbo.regionsettings ADD CONSTRAINT
	PK__regionse__5B35159D21B6055D PRIMARY KEY CLUSTERED 
	(
	regionUUID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

COMMIT


:VERSION 21

BEGIN TRANSACTION

ALTER TABLE prims ADD PassTouches bit not null default 0

COMMIT


:VERSION 22

BEGIN TRANSACTION

ALTER TABLE regionsettings ADD loaded_creation_date varchar(20) 
ALTER TABLE regionsettings ADD loaded_creation_time varchar(20) 
ALTER TABLE regionsettings ADD loaded_creation_id varchar(64) 

COMMIT

:VERSION 23

BEGIN TRANSACTION

ALTER TABLE regionsettings DROP COLUMN loaded_creation_date
ALTER TABLE regionsettings DROP COLUMN loaded_creation_time
ALTER TABLE regionsettings ADD loaded_creation_datetime int NOT NULL default 0

COMMIT

:VERSION 24

BEGIN TRANSACTION

ALTER TABLE prims ADD  MediaURL varchar(255)
ALTER TABLE primshapes ADD Media TEXT NULL

COMMIT

:VERSION 25

BEGIN TRANSACTION
CREATE TABLE "regionwindlight" (
  "region_id" varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
  "water_color_r" [float] NOT NULL DEFAULT '4.000000',
  "water_color_g" [float] NOT NULL DEFAULT '38.000000',
  "water_color_b" [float] NOT NULL DEFAULT '64.000000',
  "water_fog_density_exponent" [float] NOT NULL DEFAULT '4.0',
  "underwater_fog_modifier" [float] NOT NULL DEFAULT '0.25',
  "reflection_wavelet_scale_1" [float] NOT NULL DEFAULT '2.0',
  "reflection_wavelet_scale_2" [float] NOT NULL DEFAULT '2.0',
  "reflection_wavelet_scale_3" [float] NOT NULL DEFAULT '2.0',
  "fresnel_scale" [float] NOT NULL DEFAULT '0.40',
  "fresnel_offset" [float] NOT NULL DEFAULT '0.50',
  "refract_scale_above" [float] NOT NULL DEFAULT '0.03',
  "refract_scale_below" [float] NOT NULL DEFAULT '0.20',
  "blur_multiplier" [float] NOT NULL DEFAULT '0.040',
  "big_wave_direction_x" [float] NOT NULL DEFAULT '1.05',
  "big_wave_direction_y" [float] NOT NULL DEFAULT '-0.42',
  "little_wave_direction_x" [float] NOT NULL DEFAULT '1.11',
  "little_wave_direction_y" [float] NOT NULL DEFAULT '-1.16',
  "normal_map_texture" varchar(36) NOT NULL DEFAULT '822ded49-9a6c-f61c-cb89-6df54f42cdf4',
  "horizon_r" [float] NOT NULL DEFAULT '0.25',
  "horizon_g" [float] NOT NULL DEFAULT '0.25',
  "horizon_b" [float] NOT NULL DEFAULT '0.32',
  "horizon_i" [float] NOT NULL DEFAULT '0.32',
  "haze_horizon" [float] NOT NULL DEFAULT '0.19',
  "blue_density_r" [float] NOT NULL DEFAULT '0.12',
  "blue_density_g" [float] NOT NULL DEFAULT '0.22',
  "blue_density_b" [float] NOT NULL DEFAULT '0.38',
  "blue_density_i" [float] NOT NULL DEFAULT '0.38',
  "haze_density" [float] NOT NULL DEFAULT '0.70',
  "density_multiplier" [float] NOT NULL DEFAULT '0.18',
  "distance_multiplier" [float] NOT NULL DEFAULT '0.8',
  "max_altitude" int NOT NULL DEFAULT '1605',
  "sun_moon_color_r" [float] NOT NULL DEFAULT '0.24',
  "sun_moon_color_g" [float] NOT NULL DEFAULT '0.26',
  "sun_moon_color_b" [float] NOT NULL DEFAULT '0.30',
  "sun_moon_color_i" [float] NOT NULL DEFAULT '0.30',
  "sun_moon_position" [float] NOT NULL DEFAULT '0.317',
  "ambient_r" [float] NOT NULL DEFAULT '0.35',
  "ambient_g" [float] NOT NULL DEFAULT '0.35',
  "ambient_b" [float] NOT NULL DEFAULT '0.35',
  "ambient_i" [float] NOT NULL DEFAULT '0.35',
  "east_angle" [float] NOT NULL DEFAULT '0.00',
  "sun_glow_focus" [float] NOT NULL DEFAULT '0.10',
  "sun_glow_size" [float] NOT NULL DEFAULT '1.75',
  "scene_gamma" [float] NOT NULL DEFAULT '1.00',
  "star_brightness" [float] NOT NULL DEFAULT '0.00',
  "cloud_color_r" [float] NOT NULL DEFAULT '0.41',
  "cloud_color_g" [float] NOT NULL DEFAULT '0.41',
  "cloud_color_b" [float] NOT NULL DEFAULT '0.41',
  "cloud_color_i" [float] NOT NULL DEFAULT '0.41',
  "cloud_x" [float] NOT NULL DEFAULT '1.00',
  "cloud_y" [float] NOT NULL DEFAULT '0.53',
  "cloud_density" [float] NOT NULL DEFAULT '1.00',
  "cloud_coverage" [float] NOT NULL DEFAULT '0.27',
  "cloud_scale" [float] NOT NULL DEFAULT '0.42',
  "cloud_detail_x" [float] NOT NULL DEFAULT '1.00',
  "cloud_detail_y" [float] NOT NULL DEFAULT '0.53',
  "cloud_detail_density" [float] NOT NULL DEFAULT '0.12',
  "cloud_scroll_x" [float] NOT NULL DEFAULT '0.20',
  "cloud_scroll_x_lock" tinyint NOT NULL DEFAULT '0',
  "cloud_scroll_y" [float] NOT NULL DEFAULT '0.01',
  "cloud_scroll_y_lock" tinyint NOT NULL DEFAULT '0',
  "draw_classic_clouds" tinyint NOT NULL DEFAULT '1',
  PRIMARY KEY ("region_id")
)

COMMIT

:VERSION 26

BEGIN TRANSACTION

ALTER TABLE regionsettings ADD map_tile_ID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'

COMMIT

:VERSION 27         #---------------------

BEGIN TRANSACTION
ALTER TABLE land ADD MediaType VARCHAR(32) NOT NULL DEFAULT 'none/none' 
ALTER TABLE land ADD MediaDescription VARCHAR(255) NOT NULL DEFAULT ''
ALTER TABLE land ADD MediaSize VARCHAR(16) NOT NULL DEFAULT '0,0'
ALTER TABLE land ADD MediaLoop bit NOT NULL DEFAULT 0
ALTER TABLE land ADD ObscureMusic bit NOT NULL DEFAULT 0
ALTER TABLE land ADD ObscureMedia bit NOT NULL DEFAULT 0
COMMIT

:VERSION 28         #---------------------

BEGIN TRANSACTION

ALTER TABLE prims 
ADD CONSTRAINT DF_prims_CreatorID 
DEFAULT '00000000-0000-0000-0000-000000000000' 
FOR CreatorID

ALTER TABLE prims  ALTER COLUMN CreatorID uniqueidentifier NOT NULL

ALTER TABLE primitems
ADD CONSTRAINT DF_primitems_CreatorID 
DEFAULT '00000000-0000-0000-0000-000000000000' 
FOR CreatorID

ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL

COMMIT

:VERSION 29         #----------------- Region Covenant changed time

BEGIN TRANSACTION

ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0

COMMIT

:VERSION 30         #------------------Migrate creatorID storage to varchars instead of UUIDs for HG support

BEGIN TRANSACTION

EXECUTE sp_rename N'dbo.prims.creatorid', N'creatoridold', 'COLUMN'
EXECUTE sp_rename N'dbo.primitems.creatorid', N'creatoridold', 'COLUMN'

COMMIT

:VERSION 31        #---------------------

BEGIN TRANSACTION

ALTER TABLE prims ADD CreatorID varchar(255)
ALTER TABLE primitems ADD CreatorID varchar(255)

COMMIT

:VERSION 32        #---------------------

BEGIN TRANSACTION

UPDATE prims SET prims.CreatorID = CONVERT(varchar(255), creatoridold)
UPDATE primitems SET primitems.CreatorID = CONVERT(varchar(255), creatoridold)

COMMIT

:VERSION 33       #---------------------

BEGIN TRANSACTION

ALTER TABLE prims 
ADD CONSTRAINT DF_prims_CreatorIDNew 
DEFAULT '00000000-0000-0000-0000-000000000000' 
FOR CreatorID

ALTER TABLE prims ALTER COLUMN CreatorID varchar(255) NOT NULL

ALTER TABLE primitems
ADD CONSTRAINT DF_primitems_CreatorIDNew
DEFAULT '00000000-0000-0000-0000-000000000000' 
FOR CreatorID

ALTER TABLE primitems ALTER COLUMN CreatorID varchar(255) NOT NULL

COMMIT

:VERSION 34		  #--------------- Telehub support

BEGIN TRANSACTION

CREATE TABLE [dbo].[Spawn_Points](
	[RegionUUID] [uniqueidentifier] NOT NULL,
	[Yaw] [float] NOT NULL,
	[Pitch] [float] NOT NULL,
	[Distance] [float] NOT NULL,
	PRIMARY KEY CLUSTERED 
	(
		[RegionUUID] ASC
	)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE regionsettings ADD TelehubObject uniqueidentifier NOT NULL  DEFAULT '00000000-0000-0000-0000-000000000000';

COMMIT

:VERSION 35       #---------------- Parcels for sale

BEGIN TRANSACTION

ALTER TABLE regionsettings ADD parcel_tile_ID uniqueidentifier NOT NULL  DEFAULT '00000000-0000-0000-0000-000000000000';

COMMIT

:VERSION 36       #---------------- Timed bans/access

BEGIN TRANSACTION

ALTER TABLE landaccesslist ADD Expires integer NOT NULL  DEFAULT 0;

COMMIT

:VERSION 37       #---------------- Environment Settings

BEGIN TRANSACTION

CREATE TABLE [dbo].[regionenvironment](
	[region_id] [uniqueidentifier] NOT NULL,
	[llsd_settings] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
 PRIMARY KEY CLUSTERED
(
	[region_id] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

COMMIT

:VERSION 38       #---------------- Dynamic attributes

BEGIN TRANSACTION

ALTER TABLE prims ADD DynAttrs TEXT;

COMMIT

:VERSION 39       #---------------- Extra physics params

BEGIN TRANSACTION

ALTER TABLE prims ADD `PhysicsShapeType` tinyint(4) NOT NULL default '0';
ALTER TABLE prims ADD `Density` double NOT NULL default '1000';
ALTER TABLE prims ADD `GravityModifier` double NOT NULL default '1';
ALTER TABLE prims ADD `Friction` double NOT NULL default '0.6';
ALTER TABLE prims ADD `Restitution` double NOT NULL default '0.5';

COMMIT
