Index: trunk/ippdb/src/ippdb.c
===================================================================
--- trunk/ippdb/src/ippdb.c	(revision 18595)
+++ trunk/ippdb/src/ippdb.c	(revision 18796)
@@ -23053,5 +23053,5 @@
 static void magicRunRowFree(magicRunRow *object);
 
-magicRunRow *magicRunRowAlloc(psS64 magic_id, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, psTime* registered, psS16 fault)
+magicRunRow *magicRunRowAlloc(psS64 magic_id, psS64 exp_id, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, psTime* registered, psS16 fault)
 {
     magicRunRow     *_object;
@@ -23061,4 +23061,5 @@
 
     _object->magic_id = magic_id;
+    _object->exp_id = exp_id;
     _object->state = psStringCopy(state);
     _object->workdir = psStringCopy(workdir);
@@ -23090,4 +23091,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_id", PS_DATA_S64, "Key", 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        psFree(md);
+        return false;
+    }
     if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, "Key", "64")) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item state");
@@ -23138,9 +23144,14 @@
 }
 
-bool magicRunInsert(psDB * dbh, psS64 magic_id, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, psTime* registered, psS16 fault)
+bool magicRunInsert(psDB * dbh, psS64 magic_id, psS64 exp_id, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, psTime* registered, psS16 fault)
 {
     psMetadata *md = psMetadataAlloc();
     if (!psMetadataAdd(md, PS_LIST_TAIL, "magic_id", PS_DATA_S64, NULL, magic_id)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item magic_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_id", PS_DATA_S64, NULL, exp_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
         psFree(md);
         return false;
@@ -23204,5 +23215,5 @@
 bool magicRunInsertObject(psDB *dbh, magicRunRow *object)
 {
-    return magicRunInsert(dbh, object->magic_id, object->state, object->workdir, object->workdir_state, object->label, object->dvodb, object->registered, object->fault);
+    return magicRunInsert(dbh, object->magic_id, object->exp_id, object->state, object->workdir, object->workdir_state, object->label, object->dvodb, object->registered, object->fault);
 }
 
@@ -23282,4 +23293,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_id", PS_DATA_S64, NULL, object->exp_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        psFree(md);
+        return false;
+    }
     if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, object->state)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item state");
@@ -23331,4 +23347,9 @@
         return false;
     }
+    psS64 exp_id = psMetadataLookupS64(&status, md, "exp_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_id");
+        return false;
+    }
     char* state = psMetadataLookupPtr(&status, md, "state");
     if (!status) {
@@ -23367,5 +23388,5 @@
     }
 
-    return magicRunRowAlloc(magic_id, state, workdir, workdir_state, label, dvodb, registered, fault);
+    return magicRunRowAlloc(magic_id, exp_id, state, workdir, workdir_state, label, dvodb, registered, fault);
 }
 psArray *magicRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Index: trunk/ippdb/src/ippdb.h
===================================================================
--- trunk/ippdb/src/ippdb.h	(revision 18595)
+++ trunk/ippdb/src/ippdb.h	(revision 18796)
@@ -10029,4 +10029,5 @@
 typedef struct {
     psS64           magic_id;
+    psS64           exp_id;
     char            *state;
     char            *workdir;
@@ -10045,4 +10046,5 @@
 magicRunRow *magicRunRowAlloc(
     psS64           magic_id,
+    psS64           exp_id,
     const char      *state,
     const char      *workdir,
@@ -10082,4 +10084,5 @@
     psDB            *dbh,               ///< Database handle
     psS64           magic_id,
+    psS64           exp_id,
     const char      *state,
     const char      *workdir,
