-- MySQL dump 9.10
--
-- Host: localhost    Database: track
-- ------------------------------------------------------
-- Server version	4.0.18-max-nt

--
-- Table structure for table `beam`
--

CREATE TABLE beam (
  branchline varchar(20) NOT NULL default '',
  beamID int(11) NOT NULL auto_increment,
  centerX double(15,6) default NULL,
  centerY double(15,6) default NULL,
  bmstpShdwX double(15,6) default NULL,
  bmstpShdwY double(15,6) default NULL,
  bmstpShdwR double(15,6) default NULL,
  divergenceX double(15,6) default NULL,
  divergenceY double(15,6) default NULL,
  dispersion double(15,6) default NULL,
  synchPolariz double(15,6) default NULL,
  findSpotThresh int(11) default NULL,
  findSpotBgMin double(15,6) default NULL,
  findSpotBgMax double(15,6) default NULL,
  createDate timestamp(14) NOT NULL,
  detectorID int(11) default NULL,
  PRIMARY KEY  (beamID)
) TYPE=InnoDB;

--
-- Table structure for table `beamlogmain`
--

CREATE TABLE beamlogmain (
  branchline varchar(20) default NULL,
  beamLogID int(11) NOT NULL auto_increment,
  createDate timestamp(14) NOT NULL,
  PRIMARY KEY  (beamLogID)
) TYPE=InnoDB;

--
-- Table structure for table `beamlogold`
--

CREATE TABLE beamlogold (
  branchline varchar(32) default NULL,
  ringCurrent float default NULL,
  Izero int(11) default NULL,
  BPMxA int(11) default NULL,
  BPMxB int(11) default NULL,
  BPMyA int(11) default NULL,
  BPMyB int(11) default NULL,
  LNlevel int(11) default NULL,
  LNpressure int(11) default NULL,
  modifyDate timestamp(14) NOT NULL,
  createDate timestamp(14) NOT NULL default '00000000000000',
  KEY beamLogDate (createDate),
  KEY beamLogBranchline (branchline)
) TYPE=InnoDB;

--
-- Table structure for table `beamlogvalue`
--

CREATE TABLE beamlogvalue (
  beamLogID int(11) NOT NULL default '0',
  name varchar(32) NOT NULL default '',
  value float NOT NULL default '0',
  PRIMARY KEY  (beamLogID,name)
) TYPE=InnoDB;

--
-- Table structure for table `branchline`
--

CREATE TABLE branchline (
  branchline varchar(20) NOT NULL default '',
  createDate timestamp(14) NOT NULL,
  org varchar(32) default NULL
) TYPE=InnoDB;

--
-- Table structure for table `branchlinedewar`
--

CREATE TABLE branchlinedewar (
  branchline varchar(20) NOT NULL default '',
  location int(11) NOT NULL default '0',
  isCurrent int(11) NOT NULL default '0',
  createDate timestamp(14) NOT NULL,
  puckBC varchar(50) default NULL,
  puckDate timestamp(14) NOT NULL default '00000000000000'
) TYPE=InnoDB;

--
-- Table structure for table `branchlinesample`
--

CREATE TABLE branchlinesample (
  sampleID int(11) NOT NULL auto_increment,
  xtalID int(11) NOT NULL default '0',
  puckBC varchar(30) default NULL,
  location varchar(30) NOT NULL default '',
  branchline varchar(30) NOT NULL default '',
  createDate timestamp(14) NOT NULL,
  action varchar(30) NOT NULL default '',
  PRIMARY KEY  (sampleID)
) TYPE=InnoDB;

--
-- Table structure for table `center`
--

CREATE TABLE center (
  centerID int(11) NOT NULL auto_increment,
  branchline varchar(30) default NULL,
  runID int(11) default NULL,
  xtalID int(11) default NULL,
  xpos int(11) default NULL,
  ypos int(11) default NULL,
  zpos int(11) default NULL,
  createDate timestamp(14) NOT NULL,
  PRIMARY KEY  (centerID)
) TYPE=InnoDB;

--
-- Table structure for table `detector`
--

CREATE TABLE detector (
  detectorID int(11) NOT NULL auto_increment,
  serialNumber varchar(50) NOT NULL default '',
  modelNumber varchar(50) NOT NULL default '',
  type varchar(50) default NULL,
  pixelSizeX double(15,6) default NULL,
  pixelSizeY double(15,6) default NULL,
  sizeX double(16,4) default NULL,
  sizeY double(16,4) default NULL,
  gain double(15,6) default NULL,
  overloadCutoff int(11) default NULL,
  nullCutoff int(11) default NULL,
  mosfilmLimiB int(11) default NULL,
  mosfilmBias int(11) default NULL,
  mosfilmScanner varchar(80) default NULL,
  mosfilmLimits varchar(80) default NULL,
  fileExtension varchar(20) default NULL,
  PRIMARY KEY  (detectorID)
) TYPE=InnoDB;

--
-- Table structure for table `detectormode`
--

CREATE TABLE detectormode (
  detectorMode int(11) NOT NULL default '0',
  binned int(2) default NULL,
  slow int(2) default NULL,
  dezinger int(2) default NULL,
  takeDarks int(2) default NULL,
  PRIMARY KEY  (detectorMode)
) TYPE=InnoDB;

--
-- Table structure for table `organization`
--

CREATE TABLE organization (
  contact varchar(20) default NULL,
  phone varchar(20) default NULL,
  email varchar(40) default NULL,
  org varchar(20) NOT NULL default '',
  logo blob,
  PRIMARY KEY  (org)
) TYPE=InnoDB;

--
-- Table structure for table `orgprop`
--

CREATE TABLE orgprop (
  org varchar(20) NOT NULL default '',
  type varchar(32) NOT NULL default '',
  name varchar(32) NOT NULL default '',
  value varchar(255) NOT NULL default '',
  isCurrent int(11) NOT NULL default '0',
  modifyDate timestamp(14) NOT NULL,
  createDate timestamp(14) NOT NULL default '00000000000000',
  PRIMARY KEY  (org,type,name,isCurrent)
) TYPE=InnoDB;

--
-- Table structure for table `pipelineresource`
--

CREATE TABLE pipelineresource (
  branchline varchar(20) default NULL,
  host varchar(80) default NULL,
  ip varchar(20) default NULL,
  port int(11) default NULL,
  path varchar(120) default NULL,
  status varchar(10) default NULL
) TYPE=InnoDB;

--
-- Table structure for table `puck`
--

CREATE TABLE puck (
  org varchar(20) NOT NULL default '',
  puckBC varchar(50) NOT NULL default '',
  location int(11) NOT NULL default '0',
  xtalID int(11) NOT NULL default '0',
  isCurrent int(3) NOT NULL default '0',
  modifyDate timestamp(14) NOT NULL,
  createDate timestamp(14) NOT NULL default '00000000000000',
  KEY puck_puckbc (puckBC),
  KEY puckcur (org,puckBC,isCurrent),
  KEY puck_xtal_cur (xtalID,isCurrent)
) TYPE=InnoDB;

--
-- Table structure for table `run`
--

CREATE TABLE run (
  runID int(11) NOT NULL auto_increment,
  runType varchar(30) default NULL,
  beamID int(11) default NULL,
  branchline varchar(20) NOT NULL default '',
  protocolID int(11) default NULL,
  runName varchar(50) default NULL,
  xtalID int(11) NOT NULL default '-1',
  deltaPhi double(15,6) default NULL,
  skipPhi double(16,4) default '0.0000',
  deltaWedge double(15,6) default '0.000000',
  time double(15,6) default NULL,
  startPhi double(15,6) default '0.000000',
  stopPhi double(15,6) default NULL,
  wedgeSize double(15,6) default NULL,
  filePath varchar(255) default NULL,
  fileTemplate varchar(255) default NULL,
  distance double(15,6) default NULL,
  twoTheta double(16,4) default '0.0000',
  wavelength1 double(15,6) default '1.000000',
  wavelength2 double(16,4) default NULL,
  wavelength3 double(16,4) default NULL,
  wavelength4 double(16,4) default NULL,
  wavelength5 double(16,4) default NULL,
  inverseBeam int(5) default '0',
  status varchar(20) default NULL,
  createDate timestamp(14) NOT NULL,
  startFrame int(11) default NULL,
  endFrame int(11) default NULL,
  nextFrame int(11) default NULL,
  detectorMode int(11) default '4',
  runNumber int(11) default NULL,
  sync smallint(6) default '0',
  saveDate timestamp(14) NOT NULL default '00000000000000',
  PRIMARY KEY  (runID),
  KEY Run_runID_branchline (runID,branchline),
  KEY run_xtalid (xtalID),
  KEY run_date (createDate),
  KEY run_branchline (branchline)
) TYPE=InnoDB;

--
-- Table structure for table `runtemplate`
--

CREATE TABLE runtemplate (
  runType varchar(30) default NULL,
  org varchar(32) default NULL,
  deltaPhi double(15,6) default NULL,
  deltaWedge double(15,6) default NULL,
  time double(15,6) default NULL,
  startPhi double(15,6) default NULL,
  wedgeSize double(15,6) default NULL,
  filePath varchar(255) default NULL,
  fileTemplate varchar(255) default NULL,
  distance double(15,6) default NULL,
  wavelength1 double(15,6) default NULL,
  inverseBeam int(5) default NULL,
  status varchar(20) default NULL,
  createDate timestamp(14) NOT NULL,
  startFrame int(11) default NULL,
  endFrame int(11) default NULL,
  detectorMode int(11) default NULL,
  protocolName varchar(32) default NULL,
  runName varchar(32) default NULL
) TYPE=InnoDB;

--
-- Table structure for table `sampleview`
--

CREATE TABLE sampleview (
  viewID int(11) NOT NULL auto_increment,
  branchline varchar(30) NOT NULL default '',
  runID int(11) default NULL,
  xtalID int(11) default NULL,
  fileName varchar(255) NOT NULL default '',
  data mediumblob,
  centerX int(6) NOT NULL default '0',
  centerY int(6) NOT NULL default '0',
  scaleX float NOT NULL default '0',
  scaleY float NOT NULL default '0',
  colimSize int(11) NOT NULL default '100',
  zoom varchar(20) default NULL,
  phi float(10,2) default NULL,
  xpos float(10,2) default NULL,
  ypos float(10,2) default NULL,
  zpos float(10,2) default NULL,
  light1Name varchar(30) default NULL,
  light2Name varchar(30) default NULL,
  light1Value int(6) default NULL,
  light2Value int(6) default NULL,
  createDate timestamp(14) NOT NULL,
  PRIMARY KEY  (viewID)
) TYPE=InnoDB;

--
-- Table structure for table `snap`
--

CREATE TABLE snap (
  snapID int(11) NOT NULL auto_increment,
  runID int(11) NOT NULL default '0',
  sequenceNumber smallint(6) NOT NULL default '0',
  startPhi double(15,6) default NULL,
  deltaPhi double(15,6) default NULL,
  time double(15,6) default NULL,
  beamCurrent double(15,6) default NULL,
  filePath varchar(255) default NULL,
  fileName varchar(255) NOT NULL default '',
  data mediumblob,
  detDist double(15,6) default NULL,
  wavelength double(15,6) default NULL,
  createDate timestamp(14) NOT NULL,
  PRIMARY KEY  (snapID),
  KEY SNAP_RUNID (runID),
  KEY snap_filename (fileName),
  KEY snap_seq (sequenceNumber)
) TYPE=InnoDB;

--
-- Table structure for table `structure`
--

CREATE TABLE structure (
  structID int(11) NOT NULL auto_increment,
  org varchar(30) NOT NULL default '',
  project varchar(100) NOT NULL default '',
  subProject varchar(100) NOT NULL default '',
  structure varchar(100) NOT NULL default '',
  createDate timestamp(14) NOT NULL,
  PRIMARY KEY  (structID)
) TYPE=InnoDB;

--
-- Table structure for table `taskevent`
--

CREATE TABLE taskevent (
  queueID int(11) NOT NULL default '0',
  event varchar(30) NOT NULL default '',
  eventDate timestamp(14) NOT NULL,
  EventID int(11) NOT NULL auto_increment,
  PRIMARY KEY  (EventID)
) TYPE=InnoDB;

--
-- Table structure for table `taskqueue`
--

CREATE TABLE taskqueue (
  queueID int(11) NOT NULL auto_increment,
  org varchar(20) NOT NULL default '',
  branchline varchar(30) NOT NULL default '',
  xtalID int(11) NOT NULL default '0',
  puckLoc varchar(30) default NULL,
  protocolID int(11) NOT NULL default '0',
  protocolName varchar(32) default NULL,
  runID int(11) default NULL,
  toPuckBC varchar(20) default NULL,
  toPuckLoc int(11) default NULL,
  status varchar(20) NOT NULL default '',
  priority int(5) NOT NULL default '0',
  PRIMARY KEY  (queueID),
  KEY taskque_xtalid (xtalID)
) TYPE=InnoDB;

--
-- Table structure for table `xtal`
--

CREATE TABLE xtal (
  xtalID int(11) NOT NULL auto_increment,
  plateBC varchar(50) default NULL,
  well varchar(10) default NULL,
  xtalNum int(11) default NULL,
  loopSize double(15,6) default NULL,
  xtalSize double(15,6) default NULL,
  cryo varchar(50) default NULL,
  createDate timestamp(14) NOT NULL,
  name varchar(50) NOT NULL default '',
  org varchar(20) NOT NULL default '',
  structID int(11) NOT NULL default '0',
  Crystal_ID varchar(30) default NULL,
  PRIMARY KEY  (xtalID),
  KEY xtal_xtal_struct_org (xtalID,structID,org),
  KEY xtal_xtal_org (xtalID,org)
) TYPE=InnoDB;

--
-- Table structure for table `xtaleval`
--

CREATE TABLE xtaleval (
  evalID int(11) NOT NULL auto_increment,
  evalType varchar(30) default NULL,
  successCode varchar(200) default NULL,
  xtalID int(11) NOT NULL default '0',
  runID int(11) default NULL,
  snapID int(11) default NULL,
  createDate timestamp(14) NOT NULL,
  indexSolution int(11) default NULL,
  scaleSolution int(11) default NULL,
  qualityscore float(10,2) default NULL,
  resolution double(15,6) default NULL,
  distance double(15,6) default NULL,
  mosaicity double(15,6) default NULL,
  beamCenterX double(15,6) default NULL,
  beamCenterY double(15,6) default NULL,
  rmsResidual double(15,6) default NULL,
  resolutionLimit double(15,6) default NULL,
  resolutionProfile text,
  orientationMatrix text,
  spacegroup varchar(20) default NULL,
  unitCell varchar(80) default NULL,
  findSpotThresh int(11) default NULL,
  findSpotBgMin double(15,6) default NULL,
  findSpotBgMax double(15,6) default NULL,
  cutoffMessage varchar(120) default NULL,
  PRIMARY KEY  (evalID)
) TYPE=InnoDB;

--
-- Table structure for table `xtalevalsyrrx`
--

CREATE TABLE xtalevalsyrrx (
  runID int(11) default NULL,
  xtalID int(11) NOT NULL default '0',
  Salt tinyint(4) NOT NULL default '0',
  IceRings tinyint(4) NOT NULL default '0',
  DidNotDiffract tinyint(4) NOT NULL default '1',
  Anisotropic tinyint(4) NOT NULL default '0',
  Mosaicity varchar(20) NOT NULL default '',
  Diffraction varchar(20) NOT NULL default 'none',
  SpotShape varchar(20) NOT NULL default '',
  Collectable tinyint(4) NOT NULL default '0',
  modifyDate timestamp(14) NOT NULL,
  createDate timestamp(14) NOT NULL default '00000000000000',
  resolution float NOT NULL default '0',
  resolution2 float(10,2) default NULL,
  isCurrent int(4) default NULL,
  sync smallint(6) default NULL,
  KEY XtalEvalSyrrx_xtal (xtalID)
) TYPE=InnoDB;

--
-- Table structure for table `xtalplate`
--

CREATE TABLE xtalplate (
  plateBC varchar(50) NOT NULL default '',
  well varchar(10) NOT NULL default '',
  mLiqID int(11) default NULL,
  PRIMARY KEY  (plateBC,well)
) TYPE=InnoDB;

