id,summary,reporter,owner,description,type,status,priority,component,severity,resolution,keywords,cc,release
9629,Creating the necessary tables fails if using MySQL database and installing into second environment,anonymous,bobbysmith007,The trac-admin upgrade fails to create necessary tables in second database of MySQL server if the table already exist in some other database.\r\n\r\nThe 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.\r\n\r\nFollowing 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.\r\n\r\ndiff -Naur timingandestimationplugin.original/branches/trac0.12/timingandestimationplugin/dbhelper.py timingandestimationplugin/branches/trac0.12/timingandestimationplugin/db\r\nhelper.py\r\n--- timingandestimationplugin.original/branches/trac0.12/timingandestimationplugin/dbhelper.py  2011-10-13 13:50:24.000000000 +0000\r\n+++ timingandestimationplugin/branches/trac0.12/timingandestimationplugin/dbhelper.py   2011-12-21 13:42:52.000000000 +0000\r\n@@ -86_7 +86_7 @@\r\n     if(type(db.cnx) == trac.db.sqlite_backend.SQLiteConnection):\r\n         sql = "select count(*) from sqlite_master where type = 'table' and name = %s"\r\n     else:\r\n-        sql = "SELECT count(*) FROM information_schema.tables WHERE table_name = %s"\r\n+        sql = "SELECT count(*) FROM information_schema.tables WHERE table_name = %s AND table_schema = schema()"\r\n     cnt = get_scalar(env_ sql_ 0_ table)\r\n     return cnt > 0\r\n,defect,closed,normal,TimingAndEstimationPlugin,normal,fixed,,,0.12
