#!/usr/bin/env python

import sys
startAt = sys.argv[1]

template = """CREATE TABLE `neb_0_%s` (
  `filename` varchar(255) NOT NULL,
  `neb_ins_id` bigint(20) NOT NULL default '-1',
  `subdirname` char(3) NOT NULL,
  `nebkey` varchar(255) default NULL,
  `size` int(11) 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',
  `stage` enum('undefined','unknown','raw','chip','cam','fake','detrend','warp','stack','diff','magic','destreak','dist','pub','staticsky','chipbackground') NOT NULL default 'undefined',
  `lifetime` enum('undefined','permanent','ephemeral','raw','unknown') NOT NULL default 'undefined',
  `status` enum('undefined','ok','deleted','error') NOT NULL default 'undefined',
  `creation_date` timestamp NOT NULL default '0000-00-00 00:00:00',
  `last_check` timestamp NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`filename`),
  KEY `subdirname` (`subdirname`),
  KEY `nebkey` (`nebkey`),
  KEY `role` (`role`),
  KEY `stage` (`stage`),
  KEY `lifetime` (`lifetime`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"""

letters = "0123456789abcdef"

for letter1 in letters:
    for letter2 in letters:
        index = '%s%s' % (letter1, letter2)
        if index >= startAt:
            print template % index
