Index: /branches/eam_branches/ipp-20121219/ippToPsps/jython/dvo.py
===================================================================
--- /branches/eam_branches/ipp-20121219/ippToPsps/jython/dvo.py	(revision 35030)
+++ /branches/eam_branches/ipp-20121219/ippToPsps/jython/dvo.py	(revision 35031)
@@ -33,5 +33,5 @@
 
     '''
-    def __init__(self, logger, config, scratchDbName="ipptopsps_scratch"):
+    def __init__(self, logger, config, scratchDbName="ipptopsps_test_scratch"):
 
         # set up logging
@@ -570,5 +570,28 @@
     def nativeIngestDetections(self, raCenter, decCenter, boxSize):
 
-        # self.scratchDb.resetAllDvoTables()
+        # XXX put the chunk below in a separate method 
+        
+        # drop detections table
+        self.logger.infoPair("Dropping table", self.scratchDb.dvoDetectionTable)
+        self.scratchDb.dropTable(self.scratchDb.dvoDetectionTable)
+        
+        # create detections table
+        self.logger.infoPair("Creating table", self.scratchDb.dvoDetectionTable)
+        sql = "CREATE TABLE " + self.scratchDb.dvoDetectionTable + " LIKE dvoDetection"
+        try: self.scratchDb.execute(sql)
+        except:
+            self.logger.errorPair("Unable to create table", self.scratchDb.dvoDetectionTable)
+            return False
+        self.scratchDb.changeEngineToInnoDB(self.scratchDb.dvoDetectionTable)
+        
+        # add fileID column
+        sql = "ALTER TABLE " + self.scratchDb.dvoDetectionTable + " ADD fileID INT NOT NULL"
+        try: self.scratchDb.execute(sql)
+        except: 
+            self.logger.errorPair("Unable to add fileID column to ", self.scratchDb.dvoDetectionTable)
+            return False
+
+        # add an index to the fileID column
+        self.scratchDb.createIndex(self.scratchDb.dvoDetectionTable, "fileID")
 
         # make sure we have an up-to-date Images table
