aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/PGSQL/Resources/InventoryStore.migrations
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/PGSQL/Resources/InventoryStore.migrations211
1 files changed, 211 insertions, 0 deletions
diff --git a/OpenSim/Data/PGSQL/Resources/InventoryStore.migrations b/OpenSim/Data/PGSQL/Resources/InventoryStore.migrations
new file mode 100644
index 0000000..b61e1f8
--- /dev/null
+++ b/OpenSim/Data/PGSQL/Resources/InventoryStore.migrations
@@ -0,0 +1,211 @@
1:VERSION 1
2
3BEGIN TRANSACTION;
4
5CREATE TABLE inventoryfolders (
6 "folderID" varchar(36) NOT NULL default '' PRIMARY KEY,
7 "agentID" varchar(36) default NULL,
8 "parentFolderID" varchar(36) default NULL,
9 "folderName" varchar(64) default NULL,
10 "type" smallint NOT NULL default 0,
11 "version" int NOT NULL default 0
12);
13
14
15CREATE INDEX owner ON inventoryfolders
16(
17 "agentID" ASC
18);
19
20CREATE INDEX parent ON inventoryfolders
21(
22 "parentFolderID" ASC
23);
24
25
26CREATE TABLE inventoryitems (
27 "inventoryID" varchar(36) NOT NULL default '' Primary Key,
28 "assetID" varchar(36) default NULL,
29 "assetType" int default NULL,
30 "parentFolderID" varchar(36) default NULL,
31 "avatarID" varchar(36) default NULL,
32 "inventoryName" varchar(64) default NULL,
33 "inventoryDescription" varchar(128) default NULL,
34 "inventoryNextPermissions" int default NULL,
35 "inventoryCurrentPermissions" int default NULL,
36 "invType" int default NULL,
37 "creatorID" varchar(36) default NULL,
38 "inventoryBasePermissions" int NOT NULL default 0,
39 "inventoryEveryOnePermissions" int NOT NULL default 0,
40 "salePrice" int default NULL,
41 "saleType" smallint default NULL,
42 "creationDate" int default NULL,
43 "groupID" varchar(36) default NULL,
44 "groupOwned" boolean default NULL,
45 "flags" int default NULL
46);
47
48
49CREATE INDEX ii_owner ON inventoryitems
50(
51 "avatarID" ASC
52);
53
54CREATE INDEX ii_folder ON inventoryitems
55(
56 "parentFolderID" ASC
57);
58
59COMMIT;
60
61
62:VERSION 2
63
64BEGIN TRANSACTION;
65
66ALTER TABLE inventoryitems ADD "inventoryGroupPermissions" INTEGER NOT NULL default 0;
67
68COMMIT;
69
70:VERSION 3
71
72/* To prevent any potential data loss issues, you should review this script in detail before running it outside the cotext of the database designer.*/
73BEGIN TRANSACTION;
74
75CREATE TABLE Tmp_inventoryfolders
76 (
77 "folderID" uuid NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
78 "agentID" uuid NULL DEFAULT (NULL),
79 "parentFolderID" uuid NULL DEFAULT (NULL),
80 "folderName" varchar(64) NULL DEFAULT (NULL),
81 "type" smallint NOT NULL DEFAULT ((0)),
82 "version" int NOT NULL DEFAULT ((0))
83 );
84
85 INSERT INTO Tmp_inventoryfolders ("folderID", "agentID", "parentFolderID", "folderName", type, version)
86 SELECT cast("folderID" as uuid), cast("agentID" as uuid), cast("parentFolderID" as uuid), "folderName", "type", "version"
87 FROM inventoryfolders;
88
89DROP TABLE inventoryfolders;
90
91alter table Tmp_inventoryfolders rename to inventoryfolders;
92
93ALTER TABLE inventoryfolders ADD CONSTRAINT
94 PK__inventor__C2FABFB3173876EA PRIMARY KEY
95 (
96 "folderID"
97 );
98
99CREATE INDEX owner ON inventoryfolders
100 (
101 "agentID"
102 );
103
104CREATE INDEX parent ON inventoryfolders
105 (
106 "parentFolderID"
107 );
108
109COMMIT;
110
111
112:VERSION 4
113
114BEGIN TRANSACTION;
115
116CREATE TABLE Tmp_inventoryitems
117 (
118 "inventoryID" uuid NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
119 "assetID" uuid NULL DEFAULT (NULL),
120 "assetType" int NULL DEFAULT (NULL),
121 "parentFolderID" uuid NULL DEFAULT (NULL),
122 "avatarID" uuid NULL DEFAULT (NULL),
123 "inventoryName" varchar(64) NULL DEFAULT (NULL),
124 "inventoryDescription" varchar(128) NULL DEFAULT (NULL),
125 "inventoryNextPermissions" int NULL DEFAULT (NULL),
126 "inventoryCurrentPermissions" int NULL DEFAULT (NULL),
127 "invType" int NULL DEFAULT (NULL),
128 "creatorID" uuid NULL DEFAULT (NULL),
129 "inventoryBasePermissions" int NOT NULL DEFAULT ((0)),
130 "inventoryEveryOnePermissions" int NOT NULL DEFAULT ((0)),
131 "salePrice" int NULL DEFAULT (NULL),
132 "SaleType" smallint NULL DEFAULT (NULL),
133 "creationDate" int NULL DEFAULT (NULL),
134 "groupID" uuid NULL DEFAULT (NULL),
135 "groupOwned" boolean NULL DEFAULT (NULL),
136 "flags" int NULL DEFAULT (NULL),
137 "inventoryGroupPermissions" int NOT NULL DEFAULT ((0))
138 );
139
140
141 INSERT INTO Tmp_inventoryitems ("inventoryID", "assetID", "assetType", "parentFolderID", "avatarID", "inventoryName", "inventoryDescription", "inventoryNextPermissions", "inventoryCurrentPermissions", "invType", "creatorID", "inventoryBasePermissions", "inventoryEveryOnePermissions", "salePrice", "SaleType", "creationDate", "groupID", "groupOwned", "flags", "inventoryGroupPermissions")
142 SELECT cast("inventoryID" as uuid), cast("assetID" as uuid), "assetType", cast("parentFolderID" as uuid), cast("avatarID" as uuid), "inventoryName", "inventoryDescription", "inventoryNextPermissions", "inventoryCurrentPermissions", "invType", cast("creatorID" as uuid), "inventoryBasePermissions", "inventoryEveryOnePermissions", "salePrice", "SaleType", "creationDate", cast("groupID" as uuid), "groupOwned", "flags", "inventoryGroupPermissions"
143 FROM inventoryitems ;
144
145DROP TABLE inventoryitems;
146
147alter table Tmp_inventoryitems rename to inventoryitems;
148
149ALTER TABLE inventoryitems ADD CONSTRAINT
150 PK__inventor__C4B7BC2220C1E124 PRIMARY KEY
151 (
152 "inventoryID"
153 );
154
155
156CREATE INDEX ii2_owner ON inventoryitems
157 (
158 "avatarID"
159 );
160
161CREATE INDEX ii2_folder ON inventoryitems
162 (
163 "parentFolderID"
164 );
165
166COMMIT;
167
168:VERSION 5
169
170
171BEGIN TRANSACTION;
172
173-- # Restoring defaults:
174-- # NOTE: "inventoryID" does NOT need one: it's NOT NULL PK and a unique Guid must be provided every time anyway!
175
176alter table inventoryitems
177 alter column "inventoryBasePermissions" set default 0;
178alter table inventoryitems
179 alter column "inventoryEveryOnePermissions" set default 0;
180alter table inventoryitems
181 alter column "inventoryGroupPermissions" set default 0 ;
182
183COMMIT ;
184
185:VERSION 7
186
187BEGIN TRANSACTION;
188
189-- # "creatorID" goes back to VARCHAR(36) (???)
190
191alter table inventoryitems
192 alter column "creatorID" type varchar(36);
193
194COMMIT ;
195
196:VERSION 8
197
198ALTER TABLE inventoryitems
199 alter column "creatorID" set DEFAULT '00000000-0000-0000-0000-000000000000';
200
201
202:VERSION 9
203
204BEGIN TRANSACTION;
205
206--# "creatorID" goes up to VARCHAR(255)
207
208alter table inventoryitems
209 alter column "creatorID" type varchar(255);
210
211Commit;