Index: /trunk/dbconfig/det.md
===================================================================
--- /trunk/dbconfig/det.md	(revision 14167)
+++ /trunk/dbconfig/det.md	(revision 14168)
@@ -32,14 +32,14 @@
 
 detInputExp METADATA
-    det_id      S64         0       # Primary Key
-    iteration   S32         0       # Primary Key
-    exp_id     S64         64      # Primary Key
+    det_id      S64         0       # Primary Key INDEX(det_id, exp_id) fkey (det_id) ref detRun(det_id)
+    iteration   S32         0       # Primary Key INDEX(det_id, iteration)
+    exp_id     S64         64       # Primary Key fkey (exp_id) ref rawExp(exp_id)
     include     BOOL        f
 END
 
 detProcessedImfile METADATA
-    det_id      S64         0      # Primary Key
-    exp_id     S64         64     # Primary Key
-    class_id    STR         64     # Primary Key
+    det_id      S64         0      # Primary Key fkey (det_id, exp_id) ref detInputExp(det_id, exp_id) 
+    exp_id     S64         64      # Primary Key fkey (exp_id, class_id) ref rawImfile(exp_id, class_id)
+    class_id    STR         64     # Primary Key INDEX(det_id, class_id)
     uri         STR         255
     recipe      STR         64
@@ -60,6 +60,6 @@
 
 detProcessedExp METADATA
-    det_id      S64         0      # Primary Key
-    exp_id     S64         64     # Primary Key
+    det_id      S64         0       # Primary Key fkey(det_id, exp_id) ref detInputExp(det_id, exp_id)
+    exp_id     S64         64       # Primary Key
     recipe      STR         64
     bg          F64         0.0
@@ -79,6 +79,6 @@
 
 detStackedImfile METADATA
-    det_id      S64         0       # Primary Key
-    iteration   S32         0       # Primary Key
+    det_id      S64         0       # Primary Key fkey(det_id, iteration) ref detInputExp(det_id, iteration)
+    iteration   S32         0       # Primary Key fkey(det_id, class_id) ref  detProcessedImfile(det_id, class_id)
     class_id    STR         64      # Primary Key
     uri         STR         255
@@ -96,5 +96,5 @@
 
 detNormalizedStatImfile METADATA
-    det_id      S64         0       # Primary Key
+    det_id      S64         0       # Primary Key fkey(det_id, iteration, class_id) ref detStackedImfile(det_id, iteration, class_id)
     iteration   S32         0       # Primary Key
     class_id    STR         64      # Primary Key
@@ -103,7 +103,11 @@
 END
 
+# we can not setup a fkey against detStackedImfile here as it would preference
+# detrend registration nor can we fkey iteration as a registered detrend image
+# will not have any entrires in detInputExp
+
 detNormalizedImfile METADATA
-    det_id      S64         0       # Primary Key
-    iteration   S32         0       # Primary Key
+    det_id      S64         0       # Primary Key INDEX(det_id, iteration) fkey(det_id) ref detInputExp(det_id)
+    iteration   S32         0       # Primary Key 
     class_id    STR         64      # Primary Key
     uri         STR         255
@@ -121,5 +125,5 @@
 
 detNormalizedExp METADATA
-    det_id      S64         0       # Primary Key
+    det_id      S64         0       # Primary Key fkey(det_id, iteration) ref detNormalizedImfile(det_id, iteration)
     iteration   S32         0       # Primary Key
     recipe      STR         64
@@ -196,5 +200,5 @@
 
 detRunSummary METADATA
-    det_id      S64         0       # Primary Key
+    det_id      S64         0       # Primary Key fkey(det_id, iteration) ref detInputExp(det_id, iteration)
     iteration   S32         0       # Primary Key
     bg          F64         0.0
