Commits

Anonymous committed fe5a448

Fixed the version 14 schema upgrade script.

Comments (0)

Files changed (1)

trac/upgrades/db14.py

     base_path       text,
     base_rev        text,
     UNIQUE(rev, path, change)
-);"""
+);""",
 """INSERT INTO node_change (rev,path,kind,change,base_path,base_rev)
     SELECT rev,path,kind,change,base_path,base_rev FROM node_change_old;"""
 ]
     cursor.execute("SELECT name, version FROM wiki WHERE name IN "
                    "(SELECT name FROM wiki WHERE version=0) ORDER BY name,"
                    "version DESC")
-    cursor.executemany("UPDATE wiki SET version=version+1 WHERE name=%s " 
-                       "and version=%s",
-                       [tuple(row) for row in cursor.fetchall()])
+    result = cursor.fetchall()
+    if result:
+        cursor.executemany("UPDATE wiki SET version=version+1 WHERE name=%s " 
+                           "and version=%s",
+                           [tuple(row) for row in result])
 
     # Correct difference between db_default.py and upgrades/db10.py: The
     # 'change' was missing from the uniqueness constraint