DROP TABLE IF EXISTS mcm_test;
CREATE TABLE mcm_test (
  id integer NOT NULL PRIMARY KEY,
  MCM_id integer NOT NULL default '-1',
  MCM varchar(12) NOT NULL default '',
  yymmdd varchar(8) NOT NULL default '',
  hhmmss varchar(8) NOT NULL default '',
  Plate varchar(8) NOT NULL default '',
  Testrun integer NOT NULL default '-1',
  XYpos integer NOT NULL default '-1',
  ChipId varchar(8) NOT NULL default '',
  Wafer integer NOT NULL default '-1',
  TCON varchar(8) NOT NULL default '',
  JTAG_CLK varchar(8) NOT NULL default '',
  JTAG_PRE varchar(8) NOT NULL default '',
  JTAG_NIP0 varchar(16) NOT NULL default '',
  JTAG_NIP1 varchar(16) NOT NULL default '',
  JTAG_NIP2 varchar(16) NOT NULL default '',
  JTAG_NIP3 varchar(16) NOT NULL default '',
  JTAG_NIP4 varchar(16) NOT NULL default '',
  SCSN varchar(8) NOT NULL default '',
  RSTsp varchar(4) NOT NULL default '',
  RSTout20 varchar(4) NOT NULL default '',
  SE_IO20 varchar(4) NOT NULL default '',
  CLK30 varchar(8) NOT NULL default '',
  PRE30 varchar(8) NOT NULL default '',
  I_PASA varchar(8) NOT NULL default '',
  I_1V8a varchar(12) NOT NULL default '',
  I_1V8d varchar(12) NOT NULL default '',
  I_3V3d varchar(12) NOT NULL default '',
  INTTST varchar(10) NOT NULL default '',
  DMEM varchar(10) NOT NULL default '',
  NIOUT varchar(24) NOT NULL default '',
  BMCM varchar(4) NOT NULL default '',
  NIP0 varchar(24) NOT NULL default '',
  NIP1 varchar(24) NOT NULL default '',
  NIP2 varchar(24) NOT NULL default '',
  NIP3 varchar(24) NOT NULL default '',
  LUTEBF varchar(4) NOT NULL default '',
  FPD varchar(12) NOT NULL default '',
  RestF varchar(12) NOT NULL default '',
  PASA_CM varchar(8) NOT NULL default '',
  PASA_REFn varchar(8) NOT NULL default '',
  PASA_REFp varchar(8) NOT NULL default '',
  PASA_E1n varchar(8) NOT NULL default '',
  PASA_E1p varchar(8) NOT NULL default '',
  PASA_E17n varchar(8) NOT NULL default '',
  PASA_E17p varchar(8) NOT NULL default '',
  PASA_E18n varchar(8) NOT NULL default '',
  PASA_E18p varchar(8) NOT NULL default '',
  TRAP_VREF varchar(8) NOT NULL default '',
  PASAI varchar(24) NOT NULL default '',
  PASAE varchar(24) NOT NULL default '',
  PASAO varchar(24) NOT NULL default '',
  ADC varchar(24) NOT NULL default '',
  ADCbaserms varchar(24) NOT NULL default '',
  A_DDSr float NOT NULL default '-1',
  A_DDSm1 float NOT NULL default '-1',
  A_DDS0 float NOT NULL default '-1',
  A_DDS19 float NOT NULL default '-1',
  sadc18d_m varchar(8) NOT NULL default '',
  sadc18d_r varchar(8) NOT NULL default '',
  sadc18a_m varchar(8) NOT NULL default '',
  sadc18a_r varchar(8) NOT NULL default '',
  sadc33_m varchar(8) NOT NULL default '',
  sadc33_r varchar(8) NOT NULL default '',
  Td_l_m varchar(8) NOT NULL default '',
  Td_l_r varchar(8) NOT NULL default '',
  Td_h_m varchar(8) NOT NULL default '',
  Td_h_r varchar(8) NOT NULL default '',
  trtCode varchar(30) NOT NULL default '',
  scCode varchar(28) NOT NULL default '',
  Function varchar(8) NOT NULL default '',
  Remark varchar(128) NOT NULL default '',
  SVNver varchar(8) NOT NULL default '',
  BRDid varchar(16) NOT NULL default '',
  DMDELA varchar(4) NOT NULL default '',
  DMDELS varchar(4) NOT NULL default '',
  QDA_MIN_CONST varchar(4) NOT NULL default '',
  DDS_AMP_Vpp varchar(8) NOT NULL default '',
  plot varchar(4) NOT NULL default ''
-- unfortunately, the following two principial constraints cannot be
-- enforced at the db level due to inconsistencies in the way tables are filled
--  , FOREIGN KEY (MCM_id) REFERENCES mcm (label_num) ON DELETE RESTRICT
--  , FOREIGN KEY (ChipId) REFERENCES mcm (laser_num) ON DELETE RESTRICT
);
