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
|
:VERSION 1
BEGIN TRANSACTION;
CREATE TABLE Avatars (
"PrincipalID" uuid NOT NULL PRIMARY KEY,
"Name" varchar(32) NOT NULL,
"Value" varchar(255) NOT NULL DEFAULT ''
);
COMMIT;
:VERSION 2
BEGIN TRANSACTION;
CREATE TABLE Tmp_Avatars
(
"PrincipalID" uuid NOT NULL,
"Name" varchar(32) NOT NULL,
"Value" text NOT NULL DEFAULT ''
) ;
INSERT INTO Tmp_Avatars ("PrincipalID", "Name", "Value")
SELECT "PrincipalID", cast("Name" as text), "Value"
FROM Avatars ;
DROP TABLE Avatars;
Alter table Tmp_Avatars
rename to Avatars;
COMMIT;
:VERSION 3
BEGIN TRANSACTION;
CREATE TABLE Tmp_Avatars
(
"PrincipalID" uuid NOT NULL,
"Name" varchar(32) NOT NULL,
"Value" text NOT NULL DEFAULT ''
);
ALTER TABLE Tmp_Avatars ADD PRIMARY KEY ("PrincipalID", "Name");
INSERT INTO Tmp_Avatars ("PrincipalID", "Name", "Value")
SELECT "PrincipalID", "Name", cast("Value" as text) FROM Avatars ;
DROP TABLE Avatars;
Alter table Tmp_Avatars
rename to Avatars;
COMMIT;
|