CREATE TABLE @TABLE_NAME@ (
  filename   VARCHAR(255) PRIMARY KEY,
  neb_ins_id BIGINT(20) NOT NULL DEFAULT -1,
  subdirname CHAR(3) NOT NULL,
  INDEX(subdirname),
  nebkey     VARCHAR(255),
  INDEX(nebkey),
  size       INT DEFAULT -1,
  md5sum     CHAR(33) DEFAULT NULL,
  role       ENUM('undefined', 'unknown', 'b1fits', 'b1jpg', 'b2fits', 
               'b2jpg', 'bttable', 'bundle', 'catalog', 
             'fits', 'compfits', 'kernel', 'log', 'logupdate', 'mask', 'mdc', 'mdl', 
             'miscfits', 'png', 'psf', 'ptn', 'skycell', 'stats',
             'trace', 'weight')
        NOT NULL DEFAULT 'undefined',
  INDEX(role),
  stage ENUM( 'undefined', 'unknown', 
  	      'raw', 'chip', 'cam', 'fake', 'detrend',
  	      'warp', 'stack', 'diff', 'magic', 'destreak', 
              'dist', 'pub', 'staticsky', 'chipbackground'
              )
        NOT NULL DEFAULT 'undefined',
  INDEX(stage),
  lifetime ENUM('undefined', 'permanent', 'ephemeral', 'raw', 'unknown') NOT NULL DEFAULT 'undefined',
  INDEX(lifetime),
  status ENUM('undefined', 'ok', 'deleted', 'error') NOT NULL DEFAULT 'undefined',
  INDEX(status),
  creation_date TIMESTAMP DEFAULT 0,
  last_check TIMESTAMP DEFAULT 0
) ENGINE=InnoDb;
