b566a2ec68dae9171ed1c166c1ad473319efd062
braney
  Thu Dec 1 12:12:08 2011 -0800
add a firstAdded time to the hubStatus table.  #5138
diff --git src/hg/lib/hubConnect.c src/hg/lib/hubConnect.c
index ff51ba3..1ecf76b 100644
--- src/hg/lib/hubConnect.c
+++ src/hg/lib/hubConnect.c
@@ -350,33 +350,38 @@
 while ((hel = hashNext(&cookie)) != NULL)
     {
     dbCount++;
     dyStringPrintf(dy,"%s,", hel->name);
     }
 *pCount = dbCount;
 
 return dy->string;
 }
 
 static void insertHubUrlInStatus(char *url)
 /* add a url to the hubStatus table */
 {
 struct sqlConnection *conn = hConnectCentral();
 char query[512];
+char *statusTable = getHubStatusTableName();
 
+if (sqlFieldIndex(conn, statusTable, "firstAdded") >= 0)
+    safef(query, sizeof(query), "insert into %s (hubUrl,firstAdded) values (\"%s\",now())",
+	statusTable, url);
+else
 safef(query, sizeof(query), "insert into %s (hubUrl) values (\"%s\")",
-    getHubStatusTableName(), url);
+	statusTable, url);
 sqlUpdate(conn, query);
 hDisconnectCentral(&conn);
 }
 
 static unsigned getHubId(char *url, char **errorMessage)
 /* find id for url in hubStatus table */
 {
 struct sqlConnection *conn = hConnectCentral();
 char query[512];
 char **row;
 boolean foundOne = FALSE;
 int id = 0;
 
 char *statusTableName = getHubStatusTableName();
 safef(query, sizeof(query), "select id,errorMessage from %s where hubUrl = \"%s\"", statusTableName, url);