aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MSSQL/Resources/RegionStore.migrations
blob: 45498012186b170a62d0acf6911cff2f8895ec94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
: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