--
--  受注見出し
--      t_order_title
--

-- DROP TABLE t_order_title;

CREATE TABLE t_order_title
(
    orderno         serial                  NOT NULL,   -- PriKey
    orderdate       timestamp without time zone,
    ordermember     integer,                            -- ForKey

    sendmailaddr    character varying(256),
    sendbuyer    character varying(512),
    sendpostalcd    character varying(10),
    sendprefcd      integer,                            -- ForKey
    sendaddr1       character varying(256),
    sendaddr2       character varying(256),
    sendtelno1      character varying(20),
    addressee       character varying(256),
    takkyubin integer,
    enquiryno       character varying(256),
    note                character varying(1024),

    preorderflg      boolean,
    orderprocessflg      boolean,

    delflg      boolean,
    adddate     timestamp without time zone,
    upddate     timestamp without time zone,
    updusrnm    character varying(60),
    updpcnm     character varying(60),
    updcnt      integer,

    PRIMARY KEY(orderno)
);

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


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