diff options
Diffstat (limited to 'OpenSim/Data/PGSQL/Resources/InventoryStore.migrations')
-rw-r--r-- | OpenSim/Data/PGSQL/Resources/InventoryStore.migrations | 220 |
1 files changed, 220 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..8f7982a --- /dev/null +++ b/OpenSim/Data/PGSQL/Resources/InventoryStore.migrations | |||
@@ -0,0 +1,220 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN TRANSACTION; | ||
4 | |||
5 | CREATE 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 | |||
15 | CREATE INDEX owner ON inventoryfolders | ||
16 | ( | ||
17 | "agentID" ASC | ||
18 | ); | ||
19 | |||
20 | CREATE INDEX parent ON inventoryfolders | ||
21 | ( | ||
22 | "parentFolderID" ASC | ||
23 | ); | ||
24 | |||
25 | |||
26 | CREATE 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 | |||
49 | CREATE INDEX ii_owner ON inventoryitems | ||
50 | ( | ||
51 | "avatarID" ASC | ||
52 | ); | ||
53 | |||
54 | CREATE INDEX ii_folder ON inventoryitems | ||
55 | ( | ||
56 | "parentFolderID" ASC | ||
57 | ); | ||
58 | |||
59 | COMMIT; | ||
60 | |||
61 | |||
62 | :VERSION 2 | ||
63 | |||
64 | BEGIN TRANSACTION; | ||
65 | |||
66 | ALTER TABLE inventoryitems ADD "inventoryGroupPermissions" INTEGER NOT NULL default 0; | ||
67 | |||
68 | COMMIT; | ||
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.*/ | ||
73 | BEGIN TRANSACTION; | ||
74 | |||
75 | CREATE 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 | |||
89 | DROP TABLE inventoryfolders; | ||
90 | |||
91 | alter table Tmp_inventoryfolders rename to inventoryfolders; | ||
92 | |||
93 | ALTER TABLE inventoryfolders ADD CONSTRAINT | ||
94 | PK__inventor__C2FABFB3173876EA PRIMARY KEY | ||
95 | ( | ||
96 | "folderID" | ||
97 | ); | ||
98 | |||
99 | CREATE INDEX owner ON inventoryfolders | ||
100 | ( | ||
101 | "agentID" | ||
102 | ); | ||
103 | |||
104 | CREATE INDEX parent ON inventoryfolders | ||
105 | ( | ||
106 | "parentFolderID" | ||
107 | ); | ||
108 | |||
109 | COMMIT; | ||
110 | |||
111 | |||
112 | :VERSION 4 | ||
113 | |||
114 | BEGIN TRANSACTION; | ||
115 | |||
116 | CREATE 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 | |||
145 | DROP TABLE inventoryitems; | ||
146 | |||
147 | alter table Tmp_inventoryitems rename to inventoryitems; | ||
148 | |||
149 | ALTER TABLE inventoryitems ADD CONSTRAINT | ||
150 | PK__inventor__C4B7BC2220C1E124 PRIMARY KEY | ||
151 | ( | ||
152 | "inventoryID" | ||
153 | ); | ||
154 | |||
155 | |||
156 | CREATE INDEX ii2_owner ON inventoryitems | ||
157 | ( | ||
158 | "avatarID" | ||
159 | ); | ||
160 | |||
161 | CREATE INDEX ii2_folder ON inventoryitems | ||
162 | ( | ||
163 | "parentFolderID" | ||
164 | ); | ||
165 | |||
166 | COMMIT; | ||
167 | |||
168 | :VERSION 5 | ||
169 | |||
170 | |||
171 | BEGIN 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 | |||
176 | alter table inventoryitems | ||
177 | alter column "inventoryBasePermissions" set default 0; | ||
178 | alter table inventoryitems | ||
179 | alter column "inventoryEveryOnePermissions" set default 0; | ||
180 | alter table inventoryitems | ||
181 | alter column "inventoryGroupPermissions" set default 0 ; | ||
182 | |||
183 | COMMIT ; | ||
184 | |||
185 | :VERSION 7 | ||
186 | |||
187 | BEGIN TRANSACTION; | ||
188 | |||
189 | -- # "creatorID" goes back to VARCHAR(36) (???) | ||
190 | |||
191 | alter table inventoryitems | ||
192 | alter column "creatorID" type varchar(36); | ||
193 | |||
194 | COMMIT ; | ||
195 | |||
196 | :VERSION 8 | ||
197 | |||
198 | ALTER TABLE inventoryitems | ||
199 | alter column "creatorID" set DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
200 | |||
201 | |||
202 | :VERSION 9 | ||
203 | |||
204 | BEGIN TRANSACTION; | ||
205 | |||
206 | --# "creatorID" goes up to VARCHAR(255) | ||
207 | |||
208 | alter table inventoryitems | ||
209 | alter column "creatorID" type varchar(255); | ||
210 | |||
211 | Commit; | ||
212 | |||
213 | :VERSION 10 | ||
214 | |||
215 | BEGIN TRANSACTION; | ||
216 | |||
217 | Alter table inventoryitems Rename Column "SaleType" to "saleType"; | ||
218 | |||
219 | Commit; | ||
220 | |||