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
|
:VERSION 1
CREATE TABLE assets (
"id" varchar(36) NOT NULL PRIMARY KEY,
"name" varchar(64) NOT NULL,
"description" varchar(64) NOT NULL,
"assetType" smallint NOT NULL,
"local" smallint NOT NULL,
"temporary" smallint NOT NULL,
"data" bytea NOT NULL
) ;
:VERSION 2
BEGIN TRANSACTION;
CREATE TABLE Tmp_assets
(
"id" varchar(36) NOT NULL,
"name" varchar(64) NOT NULL,
"description" varchar(64) NOT NULL,
"assetType" smallint NOT NULL,
"local" boolean NOT NULL,
"temporary" boolean NOT NULL,
"data" bytea NOT NULL
) ;
INSERT INTO Tmp_assets ("id", "name", "description", "assetType", "local", "temporary", "data")
SELECT "id", "name", "description", "assetType", case when "local" = 1 then true else false end, case when "temporary" = 1 then true else false end, "data"
FROM assets ;
DROP TABLE assets;
Alter table Tmp_assets
rename to assets;
ALTER TABLE assets ADD PRIMARY KEY ("id");
COMMIT;
:VERSION 3
BEGIN TRANSACTION;
ALTER TABLE assets add "create_time" integer default 0;
ALTER TABLE assets add "access_time" integer default 0;
COMMIT;
:VERSION 4
BEGIN TRANSACTION;
CREATE TABLE Tmp_assets
(
"id" uuid NOT NULL,
"name" varchar(64) NOT NULL,
"description" varchar(64) NOT NULL,
"assetType" smallint NOT NULL,
"local" boolean NOT NULL,
"temporary" boolean NOT NULL,
"data" bytea NOT NULL,
"create_time" int NULL,
"access_time" int NULL
) ;
INSERT INTO Tmp_assets ("id", "name", "description", "assetType", "local", "temporary", "data", "create_time", "access_time")
SELECT cast("id" as uuid), "name", "description", "assetType", "local", "temporary", "data", "create_time", "access_time"
FROM assets ;
DROP TABLE assets;
Alter table Tmp_assets
rename to assets;
ALTER TABLE assets ADD PRIMARY KEY ("id");
COMMIT;
:VERSION 5
DELETE FROM assets WHERE "id" = 'dc4b9f0b-d008-45c6-96a4-01dd947ac621';
:VERSION 6
ALTER TABLE assets ADD "asset_flags" INTEGER NOT NULL DEFAULT 0;
:VERSION 7
alter table assets add "creatorid" varchar(36) not null default '';
:VERSION 8
ALTER TABLE assets MODIFY description varchar(128);
|