--
--  メール配信
--      t_mail
--

CREATE TABLE t_mail
(
    MailCd serial NOT NULL,     -- PriKey
    Title character varying(256),
    Body text,
    SendDate timestamp,
    Target integer,
    SendState integer,

    DelFlg boolean,
    AddDate timestamp without time zone,
    UpdDate timestamp without time zone,
    UpdUsrNm character varying(60),
    UpdPcNm character varying(60),
    UpdCnt integer,

    PRIMARY KEY(MailCd)
);

-- シリアル初期値
SELECT setval('t_mail_MailCd_seq', 10000);


-- トリガ
CREATE TRIGGER trigger_master_stamp
  BEFORE INSERT OR UPDATE
  ON t_mail
  FOR EACH ROW
  EXECUTE PROCEDURE g_master_stamp();
