ALTER TABLE dat_m_shiire ADD COLUMN IF NOT EXISTS seizobi date;
ALTER TABLE dat_m_shiire ADD COLUMN IF NOT EXISTS shohikigen date;
ALTER TABLE dat_rm_shiire ADD COLUMN IF NOT EXISTS seizobi date;
ALTER TABLE dat_rm_shiire ADD COLUMN IF NOT EXISTS shohikigen date;
ALTER TABLE dat_m_ukeharai ADD COLUMN IF NOT EXISTS seizobi date;
ALTER TABLE dat_m_ukeharai ADD COLUMN IF NOT EXISTS shohikigen date;
ALTER TABLE dat_rm_ukeharai ADD COLUMN IF NOT EXISTS seizobi date;
ALTER TABLE dat_rm_ukeharai ADD COLUMN IF NOT EXISTS shohikigen date;
ALTER TABLE dat_d_ukeharai ADD COLUMN IF NOT EXISTS hinmokuhenkan numeric(1) DEFAULT 0 not null;
ALTER TABLE dat_rd_ukeharai ADD COLUMN IF NOT EXISTS  hinmokuhenkan numeric(1)  DEFAULT 0 not null;

insert into mst_menu(menucd, oyamenucd, menumei, hyojikb, kinocd, hyojijun, gaiyo, sakuseiuserid, sakuseinichiji, koshinuserid, koshinnichiji, kengengrp, haishifg) select '2028', '0200', 'セット品マスタ', '2', 'X000000026', 1300, 'セット品をメンテナンスします', 'admin', clock_timestamp(), 'admin', clock_timestamp(), '1', 0 where not exists (select 0 from mst_menu where menucd = '2028');
insert into mst_menu(menucd, oyamenucd, menumei, hyojikb, kinocd, hyojijun, gaiyo, sakuseiuserid, sakuseinichiji, koshinuserid, koshinnichiji, kengengrp, haishifg) select '1059', '0060', 'ロットトレース', '2', 'F000000010', 1300, 'ロットの追跡結果を出力します。', 'admin', clock_timestamp(), 'admin', clock_timestamp(), '1', 0 where not exists (select 0 from mst_menu where menucd = '1259');

ALTER TABLE mst_report DROP CONSTRAINT mst_report_pkey;
ALTER TABLE mst_report ADD CONSTRAINT mst_report_pkey PRIMARY KEY(kinocd, chohyokb, torihikisakicd, haisosakino);

insert into mst_report(kinocd,reportfilemei,param,sakuseiuserid,sakuseinichiji,koshinuserid,koshinnichiji,chohyokb,torihikisakicd,haisosakino) values 
('F000000010','対象ロット含有一覧表.xlsx',null,'admin',clock_timestamp(),'admin',clock_timestamp(),'31',' ',0)
,('F000000010','対象ロット構成品目一覧表.xlsx',null,'admin',clock_timestamp(),'admin',clock_timestamp(),'32',' ',0)
,('F000000010','ロットトレース表.xlsx',null,'admin',clock_timestamp(),'admin',clock_timestamp(),'33',' ',0)
;
