aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/Resources/RegionStore.migrations
blob: e583dc2bc1a53bc668b1ea072f538b61d93a1e50 (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
:VERSION 1

BEGIN TRANSACTION;

CREATE TABLE prims(
       UUID varchar(255) primary key,
       RegionUUID varchar(255),
       ParentID integer,
       CreationDate integer,
       Name varchar(255),
       SceneGroupID varchar(255),
       Text varchar(255),
       Description varchar(255),
       SitName varchar(255),
       TouchName varchar(255),
       CreatorID varchar(255),
       OwnerID varchar(255),
       GroupID varchar(255),
       LastOwnerID varchar(255),
       OwnerMask integer,
       NextOwnerMask integer,
       GroupMask integer,
       EveryoneMask integer,
       BaseMask integer,
       PositionX float,
       PositionY float,
       PositionZ float,
       GroupPositionX float,
       GroupPositionY float,
       GroupPositionZ float,
       VelocityX float,
       VelocityY float,
       VelocityZ float,
       AngularVelocityX float,
       AngularVelocityY float,
       AngularVelocityZ float,
       AccelerationX float,
       AccelerationY float,
       AccelerationZ float,
       RotationX float,
       RotationY float,
       RotationZ float,
       RotationW float, 
       ObjectFlags integer, 
       SitTargetOffsetX float NOT NULL default 0, 
       SitTargetOffsetY float NOT NULL default 0, 
       SitTargetOffsetZ float NOT NULL default 0, 
       SitTargetOrientW float NOT NULL default 0, 
       SitTargetOrientX float NOT NULL default 0, 
       SitTargetOrientY float NOT NULL default 0, 
       SitTargetOrientZ float NOT NULL default 0);

CREATE TABLE primshapes(
       UUID varchar(255) primary key,
       Shape integer,
       ScaleX float,
       ScaleY float,
       ScaleZ float,
       PCode integer,
       PathBegin integer,
       PathEnd integer,
       PathScaleX integer,
       PathScaleY integer,
       PathShearX integer,
       PathShearY integer,
       PathSkew integer,
       PathCurve integer,
       PathRadiusOffset integer,
       PathRevolutions integer,
       PathTaperX integer,
       PathTaperY integer,
       PathTwist integer,
       PathTwistBegin integer,
       ProfileBegin integer,
       ProfileEnd integer,
       ProfileCurve integer,
       ProfileHollow integer,
       Texture blob,
       ExtraParams blob, 
       State Integer NOT NULL default 0);

CREATE TABLE primitems(
       itemID varchar(255) primary key,
       primID varchar(255),
       assetID varchar(255),
       parentFolderID varchar(255),
       invType integer,
       assetType integer,
       name varchar(255),
       description varchar(255),
       creationDate integer,
       creatorID varchar(255),
       ownerID varchar(255),
       lastOwnerID varchar(255),
       groupID varchar(255),
       nextPermissions string,
       currentPermissions string,
       basePermissions string,
       everyonePermissions string,
       groupPermissions string);

CREATE TABLE terrain(
       RegionUUID varchar(255),
       Revision integer,
       Heightfield blob);

CREATE TABLE land(
       UUID varchar(255) primary key,
       RegionUUID varchar(255),
       LocalLandID string,
       Bitmap blob,
       Name varchar(255),
       Desc varchar(255),
       OwnerUUID varchar(255),
       IsGroupOwned string,
       Area integer,
       AuctionID integer,
       Category integer,
       ClaimDate integer,
       ClaimPrice integer,
       GroupUUID varchar(255),
       SalePrice integer,
       LandStatus integer,
       LandFlags string,
       LandingType string,
       MediaAutoScale string,
       MediaTextureUUID varchar(255),
       MediaURL varchar(255),
       MusicURL varchar(255),
       PassHours float,
       PassPrice string,
       SnapshotUUID varchar(255),
       UserLocationX float,
       UserLocationY float,
       UserLocationZ float,
       UserLookAtX float,
       UserLookAtY float,
       UserLookAtZ float, 
       AuthbuyerID varchar(36) NOT NULL default  '00000000-0000-0000-0000-000000000000');

CREATE TABLE landaccesslist(
       LandUUID varchar(255),
       AccessUUID varchar(255),
       Flags string);

COMMIT;

:VERSION 2

BEGIN TRANSACTION;

CREATE TABLE regionban(
		regionUUID varchar (255),
		bannedUUID varchar (255),
		bannedIp varchar (255),
		bannedIpHostMask varchar (255)
		);
       
COMMIT;

:VERSION 3

BEGIN;

ALTER TABLE primitems add flags integer not null default 0;

COMMIT;

:VERSION 4

BEGIN;

create table regionsettings (
	regionUUID char(36) not null,
	block_terraform integer not null,
	block_fly integer not null,
	allow_damage integer not null,
	restrict_pushing integer not null,
	allow_land_resell integer not null,
	allow_land_join_divide integer not null,
	block_show_in_search integer not null,
	agent_limit integer not null,
	object_bonus float not null,
	maturity integer not null,
	disable_scripts integer not null,
	disable_collisions integer not null,
	disable_physics integer not null,
	terrain_texture_1 char(36) not null,
	terrain_texture_2 char(36) not null,
	terrain_texture_3 char(36) not null,
	terrain_texture_4 char(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 integer not null,
	fixed_sun integer not null,
	sun_position float not null,
	covenant char(36));

COMMIT;

:VERSION 5

BEGIN;

delete from regionsettings;

COMMIT;

:VERSION 6

BEGIN TRANSACTION;

drop table regionsettings;
CREATE TABLE regionsettings (
  regionUUID char(36) NOT NULL,
  block_terraform int(11) NOT NULL,
  block_fly int(11) NOT NULL,
  allow_damage int(11) NOT NULL,
  restrict_pushing int(11) NOT NULL,
  allow_land_resell int(11) NOT NULL,
  allow_land_join_divide int(11) NOT NULL,
  block_show_in_search int(11) NOT NULL,
  agent_limit int(11) NOT NULL,
  object_bonus float NOT NULL,
  maturity int(11) NOT NULL,
  disable_scripts int(11) NOT NULL,
  disable_collisions int(11) NOT NULL,
  disable_physics int(11) NOT NULL,
  terrain_texture_1 char(36) NOT NULL,
  terrain_texture_2 char(36) NOT NULL,
  terrain_texture_3 char(36) NOT NULL,
  terrain_texture_4 char(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 int(11) NOT NULL,
  fixed_sun int(11) NOT NULL,
  sun_position float NOT NULL,
  covenant char(36) default NULL,
  sandbox tinyint(4) NOT NULL,
  PRIMARY KEY  (regionUUID)
);

COMMIT;

:VERSION 9

BEGIN;

ALTER TABLE prims ADD COLUMN ColorR integer not null default 0;
ALTER TABLE prims ADD COLUMN ColorG integer not null default 0;
ALTER TABLE prims ADD COLUMN ColorB integer not null default 0;
ALTER TABLE prims ADD COLUMN ColorA integer not null default 0;

COMMIT;

:VERSION 10

BEGIN;

ALTER TABLE prims ADD COLUMN ClickAction INTEGER NOT NULL default 0;

COMMIT;

:VERSION 11

BEGIN;

ALTER TABLE prims ADD COLUMN PayPrice INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN PayButton1 INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN PayButton2 INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN PayButton3 INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN PayButton4 INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN LoopedSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
ALTER TABLE prims ADD COLUMN LoopedSoundGain float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN TextureAnimation string;
ALTER TABLE prims ADD COLUMN ParticleSystem string;
ALTER TABLE prims ADD COLUMN OmegaX float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN OmegaY float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN OmegaZ float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraEyeOffsetX float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraEyeOffsetY float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraEyeOffsetZ float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraAtOffsetX float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraAtOffsetY float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN CameraAtOffsetZ float NOT NULL default 0;
ALTER TABLE prims ADD COLUMN ForceMouselook string NOT NULL default 0;
ALTER TABLE prims ADD COLUMN ScriptAccessPin INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN AllowedDrop INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN DieAtEdge string NOT NULL default 0;
ALTER TABLE prims ADD COLUMN SalePrice INTEGER NOT NULL default 0;
ALTER TABLE prims ADD COLUMN SaleType string NOT NULL default 0;

COMMIT;

:VERSION 12

BEGIN;

ALTER TABLE prims ADD COLUMN Material INTEGER NOT NULL default 3;

COMMIT;

:VERSION 13

BEGIN;

ALTER TABLE land ADD COLUMN OtherCleanTime INTEGER NOT NULL default 0;
ALTER TABLE land ADD COLUMN Dwell INTEGER NOT NULL default 0;

COMMIT;

:VERSION 14

begin;

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

commit;

:VERSION 15

BEGIN;

ALTER TABLE prims ADD COLUMN CollisionSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
ALTER TABLE prims ADD COLUMN CollisionSoundVolume float NOT NULL default 0;

COMMIT;

:VERSION 16

BEGIN;

ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;

COMMIT;

:VERSION 17

BEGIN;
CREATE TEMPORARY TABLE prims_backup(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,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,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect);
INSERT INTO prims_backup SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,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,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims;
DROP TABLE prims;
CREATE TABLE prims(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,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,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect);
INSERT INTO prims SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,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,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims_backup;
DROP TABLE prims_backup;
COMMIT;

:VERSION 18

BEGIN;

update terrain 
  set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
  where RegionUUID not like '%-%';
  

update landaccesslist
  set LandUUID = substr(LandUUID, 1, 8) || "-" || substr(LandUUID, 9, 4) || "-" || substr(LandUUID, 13, 4) || "-" || substr(LandUUID, 17, 4) || "-" || substr(LandUUID, 21, 12) 
  where LandUUID not like '%-%';

update landaccesslist
  set AccessUUID = substr(AccessUUID, 1, 8) || "-" || substr(AccessUUID, 9, 4) || "-" || substr(AccessUUID, 13, 4) || "-" || substr(AccessUUID, 17, 4) || "-" || substr(AccessUUID, 21, 12) 
  where AccessUUID not like '%-%';
  

update prims
  set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12) 
  where UUID not like '%-%';

update prims
  set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12) 
  where RegionUUID not like '%-%';

update prims
  set SceneGroupID = substr(SceneGroupID, 1, 8) || "-" || substr(SceneGroupID, 9, 4) || "-" || substr(SceneGroupID, 13, 4) || "-" || substr(SceneGroupID, 17, 4) || "-" || substr(SceneGroupID, 21, 12) 
  where SceneGroupID not like '%-%';

update prims
  set CreatorID = substr(CreatorID, 1, 8) || "-" || substr(CreatorID, 9, 4) || "-" || substr(CreatorID, 13, 4) || "-" || substr(CreatorID, 17, 4) || "-" || substr(CreatorID, 21, 12) 
  where CreatorID not like '%-%';

update prims
  set OwnerID = substr(OwnerID, 1, 8) || "-" || substr(OwnerID, 9, 4) || "-" || substr(OwnerID, 13, 4) || "-" || substr(OwnerID, 17, 4) || "-" || substr(OwnerID, 21, 12) 
  where OwnerID not like '%-%';

update prims
  set GroupID = substr(GroupID, 1, 8) || "-" || substr(GroupID, 9, 4) || "-" || substr(GroupID, 13, 4) || "-" || substr(GroupID, 17, 4) || "-" || substr(GroupID, 21, 12) 
  where GroupID not like '%-%';

update prims
  set LastOwnerID = substr(LastOwnerID, 1, 8) || "-" || substr(LastOwnerID, 9, 4) || "-" || substr(LastOwnerID, 13, 4) || "-" || substr(LastOwnerID, 17, 4) || "-" || substr(LastOwnerID, 21, 12) 
  where LastOwnerID not like '%-%';


update primshapes
  set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12) 
  where UUID not like '%-%';


update land
  set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12) 
  where UUID not like '%-%';
  
update land
  set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
  where RegionUUID not like '%-%';

update land
  set OwnerUUID = substr(OwnerUUID, 1, 8) || "-" || substr(OwnerUUID, 9, 4) || "-" || substr(OwnerUUID, 13, 4) || "-" || substr(OwnerUUID, 17, 4) || "-" || substr(OwnerUUID, 21, 12)
  where OwnerUUID not like '%-%';

update land
  set GroupUUID = substr(GroupUUID, 1, 8) || "-" || substr(GroupUUID, 9, 4) || "-" || substr(GroupUUID, 13, 4) || "-" || substr(GroupUUID, 17, 4) || "-" || substr(GroupUUID, 21, 12)
  where GroupUUID not like '%-%';

update land
  set MediaTextureUUID = substr(MediaTextureUUID, 1, 8) || "-" || substr(MediaTextureUUID, 9, 4) || "-" || substr(MediaTextureUUID, 13, 4) || "-" || substr(MediaTextureUUID, 17, 4) || "-" || substr(MediaTextureUUID, 21, 12)
  where MediaTextureUUID not like '%-%';

update land
  set SnapshotUUID = substr(SnapshotUUID, 1, 8) || "-" || substr(SnapshotUUID, 9, 4) || "-" || substr(SnapshotUUID, 13, 4) || "-" || substr(SnapshotUUID, 17, 4) || "-" || substr(SnapshotUUID, 21, 12)
  where SnapshotUUID not like '%-%';

update land
  set AuthbuyerID = substr(AuthbuyerID, 1, 8) || "-" || substr(AuthbuyerID, 9, 4) || "-" || substr(AuthbuyerID, 13, 4) || "-" || substr(AuthbuyerID, 17, 4) || "-" || substr(AuthbuyerID, 21, 12)
  where AuthbuyerID not like '%-%';
  
COMMIT;

:VERSION 19
BEGIN;
ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
COMMIT;

:VERSION 20
BEGIN;
ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
ALTER TABLE primshapes ADD COLUMN Media TEXT;
COMMIT;

:VERSION 21
BEGIN;
ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none';
ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';
ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
COMMIT;

:VERSION 22
BEGIN;
ALTER TABLE regionsettings ADD COLUMN covenant_datetime INTEGER NOT NULL default 0;
COMMIT;

:VERSION 23
BEGIN;
CREATE TABLE regionwindlight (
  region_id VARCHAR(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY,
  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_color_i FLOAT NOT NULL DEFAULT '1.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 INTEGER 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 INTEGER NOT NULL DEFAULT '0',
  cloud_scroll_y FLOAT NOT NULL DEFAULT '0.01',
  cloud_scroll_y_lock INTEGER NOT NULL DEFAULT '0',
  draw_classic_clouds INTEGER NOT NULL DEFAULT '1');

COMMIT;


:VERSION 24

BEGIN;

CREATE TABLE IF NOT EXISTS `spawn_points` (
  `RegionID` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
  `Yaw` float NOT NULL,
  `Pitch` float NOT NULL,
  `Distance` float NOT NULL
);

ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';

COMMIT;

:VERSION 25

BEGIN;
ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT;

:VERSION 26

BEGIN;

CREATE TABLE `regionenvironment` (
  `region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY,
  `llsd_settings` TEXT NOT NULL
);

COMMIT;

:VERSION 27
BEGIN;
ALTER TABLE prims ADD COLUMN DynAttrs TEXT;
COMMIT;