more robust sql scripts adding IF EXISTS to DROP TABLE statementes
[brisk.git] / sql / sql.d / 070-add-mailmgmt.sql
1 --
2 --  Table to manage mails sent to users
3 --
4 DROP TABLE IF EXISTS #PFX#mails;
5 CREATE TABLE #PFX#mails (
6        code       SERIAL PRIMARY KEY,
7        ucode      integer REFERENCES #PFX#users (code) ON DELETE cascade ON UPDATE cascade,
8        type       integer,                           -- type of email
9        tstamp     timestamp DEFAULT to_timestamp(0), -- insert time
10        subj       text,                              -- email subject
11        body_txt   text,                              -- email body (text version)
12        body_htm   text,                              -- email body (html version)
13        hash       text);                             -- reference hash to complete registration