diff options
Diffstat (limited to 'OpenSim/Data/PGSQL/Resources/XAssetStore.migrations')
-rw-r--r-- | OpenSim/Data/PGSQL/Resources/XAssetStore.migrations | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/OpenSim/Data/PGSQL/Resources/XAssetStore.migrations b/OpenSim/Data/PGSQL/Resources/XAssetStore.migrations new file mode 100644 index 0000000..df9d821 --- /dev/null +++ b/OpenSim/Data/PGSQL/Resources/XAssetStore.migrations | |||
@@ -0,0 +1,80 @@ | |||
1 | # ----------------- | ||
2 | :VERSION 1 | ||
3 | |||
4 | BEGIN; | ||
5 | |||
6 | CREATE TABLE XAssetsMeta ( | ||
7 | "ID" char(36) NOT NULL, | ||
8 | "Hash" char(32) NOT NULL, | ||
9 | "Name" varchar(64) NOT NULL, | ||
10 | "Description" varchar(64) NOT NULL, | ||
11 | "AssetType" smallint NOT NULL, | ||
12 | "Local" smallint NOT NULL, | ||
13 | "Temporary" smallint NOT NULL, | ||
14 | "CreateTime" integer NOT NULL, | ||
15 | "AccessTime" integer NOT NULL, | ||
16 | "AssetFlags" integer NOT NULL, | ||
17 | "CreatorID" varchar(128) NOT NULL, | ||
18 | PRIMARY KEY ("ID") | ||
19 | ); | ||
20 | |||
21 | CREATE TABLE XAssetsData ( | ||
22 | "Hash" char(32) NOT NULL, | ||
23 | "Data" bytea NOT NULL, | ||
24 | PRIMARY KEY ("Hash") | ||
25 | ); | ||
26 | |||
27 | COMMIT; | ||
28 | |||
29 | |||
30 | :VERSION 2 | ||
31 | |||
32 | BEGIN; | ||
33 | |||
34 | ALTER TABLE xassetsmeta ALTER COLUMN "Local" SET DATA TYPE boolean USING CASE WHEN '0' THEN FALSE ELSE TRUE END; | ||
35 | ALTER TABLE xassetsmeta ALTER COLUMN "Temporary" SET DATA TYPE boolean USING CASE WHEN '0' THEN FALSE ELSE TRUE END; | ||
36 | ALTER TABLE xassetsmeta ALTER COLUMN "Hash" SET DATA TYPE char(66); | ||
37 | ALTER TABLE xassetsdata ALTER COLUMN "Hash" SET DATA TYPE char(66); | ||
38 | |||
39 | COMMIT; | ||
40 | |||
41 | :VERSION 3 | ||
42 | |||
43 | BEGIN; | ||
44 | |||
45 | ALTER TABLE xassetsmeta RENAME COLUMN "ID" TO id; | ||
46 | ALTER TABLE xassetsmeta RENAME COLUMN "Hash" TO hash; | ||
47 | ALTER TABLE xassetsmeta RENAME COLUMN "Name" TO name; | ||
48 | ALTER TABLE xassetsmeta RENAME COLUMN "Description" TO description; | ||
49 | ALTER TABLE xassetsmeta RENAME COLUMN "Local" to local; | ||
50 | ALTER TABLE xassetsmeta RENAME COLUMN "Temporary" TO temporary; | ||
51 | ALTER TABLE xassetsmeta RENAME COLUMN "CreateTime" TO create_time; | ||
52 | ALTER TABLE xassetsmeta RENAME COLUMN "AccessTime" TO access_time; | ||
53 | ALTER TABLE xassetsmeta RENAME COLUMN "AssetFlags" TO asset_flags; | ||
54 | ALTER TABLE xassetsmeta RENAME COLUMN "CreatorID" TO creatorid; | ||
55 | ALTER TABLE xassetsmeta DROP CONSTRAINT xassetsmeta_pkey; | ||
56 | ALTER TABLE xassetsmeta ADD PRIMARY KEY (id); | ||
57 | |||
58 | |||
59 | ALTER TABLE xassetsdata RENAME COLUMN "Hash" TO hash; | ||
60 | ALTER TABLE xassetsdata RENAME COLUMN "Data" TO data; | ||
61 | ALTER TABLE xassetsdata DROP CONSTRAINT xassetsdata_pkey; | ||
62 | ALTER TABLE xassetsdata ADD PRIMARY KEY (hash); | ||
63 | |||
64 | COMMIT; | ||
65 | |||
66 | |||
67 | :VERSION 4 | ||
68 | |||
69 | BEGIN; | ||
70 | |||
71 | ALTER TABLE xassetsmeta ALTER COLUMN id SET DATA TYPE uuid USING id::uuid; | ||
72 | ALTER TABLE xassetsmeta ALTER COLUMN hash SET DATA TYPE bytea USING hash::bytea; | ||
73 | ALTER TABLE xassetsdata ALTER COLUMN hash SET DATA TYPE bytea USING hash::bytea; | ||
74 | |||
75 | COMMIT; | ||
76 | |||
77 | :VERSION 5 | ||
78 | |||
79 | BEGIN; | ||
80 | COMMIT; | ||