File: /volume1/@appstore/MailClient/etc/sql/mail_client_4.sql
-- 4-1 V4_AddIsNotificationEnabled
alter table mailbox add column is_notification_enabled boolean NOT NULL DEFAULT 0;
alter table label add column is_notification_enabled boolean NOT NULL DEFAULT 0;
-- 4-2 V5_CustomArchivedMailbox
PRAGMA temp_store = 2;
CREATE TEMP TABLE tmp_mailbox AS SELECT * FROM mailbox WHERE id = -2;
UPDATE temp.tmp_mailbox SET id=(SELECT max(id)+1 FROM mailbox);
UPDATE mailbox set id = (select id from temp.tmp_mailbox limit 1) where id = -2;
UPDATE message set id_mailbox=(select id from temp.tmp_mailbox limit 1) where id_mailbox = -2;
INSERT INTO config ('key', 'value') SELECT 'archive_mailbox', id FROM temp.tmp_mailbox limit 1;
-- 4-3 V6_AddPGPKey
CREATE TABLE pgp_key(
id integer NOT NULL,
key_id varchar(64),
type integer NOT NULL,
name varchar(1024) NOT NULL,
email varchar(1024) NOT NULL,
text text NOT NULL,
CONSTRAINT pgp_key_id_pk PRIMARY KEY (id),
CONSTRAINT key_id_type_uk UNIQUE (key_id, type)
);
-- 4-4 V7_AddPGPKeyAA (and add enabled into filter)
alter table pgp_key add column updated integer NOT NULL DEFAULT 0;
alter table filter add column enabled integer NOT NULL DEFAULT 1;
-- 4-5 V8_EnableInboxNotification
UPDATE mailbox SET is_notification_enabled = 1 WHERE id = -1;
UPDATE config SET value = '4' WHERE key = 'version';