[csw-devel] SF.net SVN: gar:[19956] csw/mgar/gar/v2/lib/python/database.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Dec 24 05:53:13 CET 2012


Revision: 19956
          http://gar.svn.sourceforge.net/gar/?rev=19956&view=rev
Author:   wahwah
Date:     2012-12-24 04:53:12 +0000 (Mon, 24 Dec 2012)
Log Message:
-----------
pkgdb: Fix the table creation order

Since the Stats table refers to the Blob table, Blob has to be created first.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/database.py

Modified: csw/mgar/gar/v2/lib/python/database.py
===================================================================
--- csw/mgar/gar/v2/lib/python/database.py	2012-12-24 04:49:21 UTC (rev 19955)
+++ csw/mgar/gar/v2/lib/python/database.py	2012-12-24 04:53:12 UTC (rev 19956)
@@ -25,8 +25,8 @@
             m.Pkginst,
             m.Srv4DependsOn,
             m.Srv4FileInCatalog,
-            m.Srv4FileStats,
-            m.Srv4FileStatsBlob)
+            m.Srv4FileStatsBlob,
+            m.Srv4FileStats)
 # Shouldn't this be in common_constants?
 SYSTEM_PKGMAP = "/var/sadm/install/contents"
 CONFIG_MTIME = "mtime"
@@ -153,7 +153,13 @@
 
   def CreateTables(self):
     for table in TABLES:
-      table.createTable(ifNotExists=True)
+      try:
+        logging.debug("Creating table %r", table)
+        table.createTable(ifNotExists=True)
+      except sqlobject.dberrors.OperationalError, e:
+        logging.error("Could not create table %r: %s", table, e)
+        raise
+        
 
   def InitialDataImport(self):
     """Imports initial data into the db.
@@ -183,10 +189,6 @@
         pass
     self.SetDatabaseSchemaVersion()
 
-  def CreateTables(self):
-    for table in TABLES:
-      table.createTable(ifNotExists=True)
-
   def ClearTablesForUpdates(self):
     for table in TABLES_THAT_NEED_UPDATES:
       table.clearTable()

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list