diff options
Diffstat (limited to 'files/expire/expire.sqlite.sql')
-rw-r--r-- | files/expire/expire.sqlite.sql | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/files/expire/expire.sqlite.sql b/files/expire/expire.sqlite.sql new file mode 100644 index 0000000..4545689 --- /dev/null +++ b/files/expire/expire.sqlite.sql @@ -0,0 +1,13 @@ +CREATE TABLE expires ( + username varchar(100) not null, + mailbox varchar(255) not null, + expire_stamp integer not null, + primary key (username, mailbox) +); +CREATE TRIGGER mergeexpires BEFORE INSERT ON expires FOR EACH ROW +BEGIN + UPDATE expires SET expire_stamp=NEW.expire_stamp + WHERE username = NEW.username AND mailbox = NEW.mailbox; + SELECT raise(ignore) + WHERE (SELECT 1 FROM expires WHERE username = NEW.username AND mailbox = NEW.mailbox) IS NOT NULL; +END; |