3 * Plain old SQL for setting up the tables for Odin mail redirection.
6 /* The various tools assume that the database is appropriate configured with
7 * the SERIALIZABLE isolation level.
12 drop view if exists odin_maildeliver
;
13 drop table if exists odin_mailredir
;
15 create table odin_mailredir
16 (lpart
varchar(64) not null,
17 dom
varchar(128) not null,
18 owner varchar(64) not null,
19 creator
varchar(64) not null,
20 recip
text not null default '',
21 expire
bigint not null,
22 st
varchar(16) not null default 'live',
23 comment text not null default '',
24 primary key (lpart
, dom
));
25 create index odin_mailredir_by_owner_st
on odin_mailredir (owner, st
);
26 create index odin_mailredir_by_expire_st
on odin_mailredir (expire
, st
);
27 create index odin_mailredir_by_recip
on odin_mailredir (recip
);
29 create view odin_maildeliver
as
30 select lpart
, dom
, recip
from odin_mailredir
33 expire
> extract(epoch
from current_timestamp));