The trac-admin upgrade fails to create necessary tables in second database of MySQL server if the table already exist in some other database.
The symptoms are lots of 'custom_report table not exist' related errors in log and the fact that the upgrade never get to the "Database is up to date, no upgrade necessary." message even when repeated, not speaking about "The Trac Environment needs to be upgraded. Run "trac-admin upgrade"" messages.
Following patch fixes the problem for MySQL. Note that while the fix look reasonable, you should verify if it works on other databases Trac is supposed to run on.
diff -Naur timingandestimationplugin.original/branches/trac0.12/timingandestimationplugin/dbhelper.py timingandestimationplugin/branches/trac0.12/timingandestimationplugin/db
helper.py
--- timingandestimationplugin.original/branches/trac0.12/timingandestimationplugin/dbhelper.py 2011-10-13 13:50:24.000000000 +0000
+++ timingandestimationplugin/branches/trac0.12/timingandestimationplugin/dbhelper.py 2011-12-21 13:42:52.000000000 +0000
@@ -86,7 +86,7 @@
if(type(db.cnx) == trac.db.sqlite_backend.SQLiteConnection):
sql = "select count(*) from sqlite_master where type = 'table' and name = %s"
else:
- sql = "SELECT count(*) FROM information_schema.tables WHERE table_name = %s"
+ sql = "SELECT count(*) FROM information_schema.tables WHERE table_name = %s AND table_schema = schema()"
cnt = get_scalar(env, sql, 0, table)
return cnt > 0