Index: /trunk/dbconfig/cam.md
===================================================================
--- /trunk/dbconfig/cam.md	(revision 14016)
+++ /trunk/dbconfig/cam.md	(revision 14017)
@@ -1,8 +1,8 @@
-# imfiles is not here... is it needed?
-
-camPendingExp METADATA
+camRun METADATA
     cam_id      S64         0       # Primary Key AUTO_INCREMENT
-    chip_id     S64         0       # Primary Key fkey(chip_id) ref chipProcessedExp(chip_id)
+    chip_id     S64         0       # Primary Key fkey(chip_id) ref chipRun(chip_id)
+    state       STR         64      # key
     workdir     STR         255 
+    workdir_state STR       64      # key
     label       STR         64      # key
     reduction   STR         64
@@ -14,10 +14,5 @@
 # the camPendingExp row gets deleted so we can not put a fkey on cam_id
     cam_id         S64      0       # Primary Key
-    chip_id        S64      0       # Primary Key fkey(chip_id) ref chipProcessedExp(chip_id)
-    workdir        STR      255 
-    label          STR      64      # key
-    reduction      STR      64
-    expgroup       STR      64      # key
-    dvodb          STR      255
+    chip_id        S64      0       # Primary Key fkey(cam_id, chip_id) ref camRun(cam_id, chip_id)
     uri            STR      255
     bg             F32      0.0
Index: /trunk/dbconfig/chip.md
===================================================================
--- /trunk/dbconfig/chip.md	(revision 14016)
+++ /trunk/dbconfig/chip.md	(revision 14017)
@@ -1,10 +1,12 @@
-# do we need nclass?
-# class is missing
+#
+#  We are dependant on the assumption that there is only ever one exp_tag in a
+#  chipRun although the database does not enforce this.
+#
 
-chipPendingExp METADATA
+chipRun METADATA
     chip_id     S64         0       # Primary Key AUTO_INCREMENT
-    exp_tag     STR         64      # Primary Key
-    guide_id    S64         0       # Not NULL
+    state       STR         64      # key
     workdir     STR         255 
+    workdir_state STR       64      # key
     label       STR         64      # key
     reduction   STR         64      # Reduction class
@@ -13,39 +15,13 @@
 END
 
-# uris in & out ?
-
-chipPendingImfile METADATA
-    chip_id     S64         0       # Primary Key
+chipInputImfile METADATA
+    chip_id     S64         0       # Primary Key fkey (chip_id) ref chipRun(chip_id)
+    exp_tag     STR         64      # Primary Key fkey (exp_tag, class_id) ref rawImfile (exp_tag, class_id)
     class_id    STR         64      # Primary Key
-    uri         STR         255
 END
 
-# nclass & ndone?
-# and/or logging imfile done better?
-
-chipProcessedExp METADATA
-    chip_id     S64         0       # Primary Key
+chipProcessedImfile METADATA
+    chip_id     S64         0       # Primary Key fkey (chip_id, exp_tag, class_id) ref chipPendingImfile(chip_id, exp_tag, class_id)
     exp_tag     STR         64      # Primary Key
-    guide_id    S64         0       # Not NULL
-    workdir     STR         255 
-    label       STR         64      # key
-    reduction   STR         64
-    expgroup    STR         64      # key
-    dvodb       STR         255
-END
-
-chipMask METADATA
-    label       STR         64      # Primary Key
-END
-
-# uris in & out ?
-# state?
-
-chipProcessedImfile METADATA
-    chip_id     S64         0       # Primary Key
-# exp_tag/guide_id are redudant with the values stored in chipProcessedExp.
-# exp_tag can be removed at virtually any time (SQL queriers will need to be
-# fixed) but guide_id needs to wait until we know if this can be tracked at
-# just the exp level.
     class_id        STR     64      # Primary Key
     uri             STR     255
@@ -71,2 +47,6 @@
     fault           S16     0       # Key NOT NULL
 END
+
+chipMask METADATA
+    label       STR         64      # Primary Key
+END
Index: /trunk/dbconfig/tasks.md
===================================================================
--- /trunk/dbconfig/tasks.md	(revision 14016)
+++ /trunk/dbconfig/tasks.md	(revision 14017)
@@ -1,3 +1,3 @@
-# $Id: tasks.md,v 1.134 2007-06-05 00:24:52 eugene Exp $
+# $Id: tasks.md,v 1.135 2007-07-05 20:13:45 jhoblitt Exp $
 
 # this table records all exposure ID ever seen from the summit
@@ -85,8 +85,10 @@
     exp_tag     STR         64      # Primary Key
     exp_id      STR         64      # Key
+    state       STR         64      # Key
     camera      STR         64      # Key
     telescope   STR         64      # Key
     imfiles     S32         0
     workdir     STR         255     # destination for output files
+    workdir_state STR       64      # key
 END
 
@@ -94,6 +96,5 @@
 # from there
 newImfile METADATA
-    exp_tag     STR         64      # Primary Key
-    class       STR         64      # Primary Key
+    exp_tag     STR         64      # Primary Key fkey(exp_tag) ref newExp(exp_tag)
     class_id    STR         64      # Primary Key
     uri         STR         255
@@ -102,5 +103,5 @@
 # paired with rawImfile
 rawExp METADATA
-    exp_tag     STR         64      # Primary Key
+    exp_tag     STR         64      # Primary Key fkey(exp_tag) ref newExp(exp_tag)
     exp_id      STR         64      # Key
     camera      STR         64
@@ -135,5 +136,5 @@
 
 rawImfile METADATA
-    exp_tag     STR         64      # Primary Key
+    exp_tag     STR         64      # Primary Key fkey(exp_tag, class_id) ref newImfile(exp_tag, class_id)
     class_id    STR         64      # Primary Key
     uri         STR         255
