--
--  仕入見出し
--      t_stock_title
--

-- DROP TABLE t_stock_title;

CREATE TABLE t_stock_title
(
    stocktitlecd    serial NOT NULL,            -- PriKey
    orderno         character varying(20),
    orderdate       timestamp without time zone NOT NULL,
    suppliercd      integer,                -- ForKey
    supplidiv       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(stocktitlecd)
);

-- シリアル初期値
SELECT setval('t_stock_title_stocktitlecd_seq', 100000);


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