Index: /trunk/dbconfig/changes.txt
===================================================================
--- /trunk/dbconfig/changes.txt	(revision 19619)
+++ /trunk/dbconfig/changes.txt	(revision 19620)
@@ -469,2 +469,22 @@
 update fakeProcessedImfile set data_state ='full';
 
+-- adding ref_det_id and ref_iter to detRun and detResidImfile
+
+ALTER TABLE detResidImfile add column ref_det_id bigint after iteration;
+ALTER TABLE detResidImfile add column ref_iter int after iteration;
+
+ALTER TABLE detResidImfile add column ref_det_id bigint after iteration;
+ALTER TABLE detResidImfile add column ref_iter int after iteration;
+
+ALTER TABLE detRun change column parent ref_det_id bigint;
+ALTER TABLE detRun add column ref_iter int after ref_det_id;
+
+-- XXX need to change the foreign key constraints on detResidImfile:
+-- This
+--    FOREIGN KEY (det_id, iteration)
+--    REFERENCES  detNormalizedExp(det_id, iteration)
+-- Becomes:
+--    FOREIGN KEY (ref_det_id, ref_iter)
+--    REFERENCES  detNormalizedExp(det_id, iteration)
+
+-- XXX Need to population ref_det_id with the contents of det_id for detRun.mode == 'master'
Index: /trunk/dbconfig/det.md
===================================================================
--- /trunk/dbconfig/det.md	(revision 19619)
+++ /trunk/dbconfig/det.md	(revision 19620)
@@ -28,5 +28,6 @@
     solang_max  F32         0.0
     label       STR         64      # key
-    parent      S32         0       # Key
+    ref_det_id  S64         0	    # reference for 'verify' and 'correction' analysis
+    ref_iter    S32         0	    # reference for 'verify' and 'correction' analysis
 END
 
@@ -165,5 +166,7 @@
     det_id      S64         0       # Primary Key fkey(det_id, iteration, exp_id) ref detInputExp(det_id, iteration, exp_id)
     iteration   S32         0       # Primary Key fkey(det_id, exp_id, class_id) ref detProcessedImfile(det_id, exp_id, class_id)
-    exp_id     S64         64       # Primary Key fkey(det_id, iteration) ref detNormalizedExp(det_id, iteration)
+    ref_det_id  S64         0	    # detrend master actually applied (same as above for 'master', but not for 'verify')
+    ref_iter    S32         0	    # detrend master actually applied (same as above for 'master', but not for 'verify')
+    exp_id      S64         64      # Primary Key fkey(det_id, iteration) ref detNormalizedExp(det_id, iteration)
     class_id    STR         64      # Primary Key INDEX(det_id, iteration, exp_id)
     uri         STR         255
