-
Notifications
You must be signed in to change notification settings - Fork 577
Expand file tree
/
Copy pathinit_version_9.sql
More file actions
74 lines (60 loc) · 1.82 KB
/
init_version_9.sql
File metadata and controls
74 lines (60 loc) · 1.82 KB
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
CREATE TEMPORARY TABLE `sent_backup` (
`msgid` blob,
`toaddress` text,
`toripe` blob,
`fromaddress` text,
`subject` text,
`message` text,
`ackdata` blob,
`lastactiontime` integer,
`status` text,
`retrynumber` integer,
`folder` text,
`encodingtype` int
) ;
INSERT INTO sent_backup SELECT msgid, toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, status, 0, folder, encodingtype FROM sent;
DROP TABLE sent;
CREATE TABLE `sent` (
`msgid` blob,
`toaddress` text,
`toripe` blob,
`fromaddress` text,
`subject` text,
`message` text,
`ackdata` blob,
`senttime` integer,
`lastactiontime` integer,
`sleeptill` int,
`status` text,
`retrynumber` integer,
`folder` text,
`encodingtype` int,
`ttl` int
) ;
INSERT INTO sent SELECT msgid, toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, lastactiontime, 0, status, 0, folder, encodingtype, 216000 FROM sent_backup;
DROP TABLE sent_backup;
ALTER TABLE pubkeys ADD address text DEFAULT '' ;
--
-- replica for loop to update hashed address
--
UPDATE pubkeys SET address=(enaddr(pubkeys.addressversion, 1, hash));
CREATE TEMPORARY TABLE `pubkeys_backup` (
`address` text,
`addressversion` int,
`transmitdata` blob,
`time` int,
`usedpersonally` text,
UNIQUE(address) ON CONFLICT REPLACE
) ;
INSERT INTO pubkeys_backup SELECT address, addressversion, transmitdata, `time`, usedpersonally FROM pubkeys;
DROP TABLE pubkeys;
CREATE TABLE `pubkeys` (
`address` text,
`addressversion` int,
`transmitdata` blob,
`time` int,
`usedpersonally` text,
UNIQUE(address) ON CONFLICT REPLACE
) ;
INSERT INTO pubkeys SELECT address, addressversion, transmitdata, `time`, usedpersonally FROM pubkeys_backup;
DROP TABLE pubkeys_backup;