Opened 13 years ago
Closed 13 years ago
#9629 closed defect (fixed)
Creating the necessary tables fails if using MySQL database and installing into second environment
Reported by: | anonymous | Owned by: | Russ Tyndall |
---|---|---|---|
Priority: | normal | Component: | TimingAndEstimationPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.12 |
Description
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
Attachments (1)
Change History (3)
Changed 13 years ago by
Attachment: | timingandestimationplugin.patch added |
---|
comment:2 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Well the schema() function doesnt exist in postgres, so I can't apply it exactly as is.
Thanks very much for the bug report and patch; sorry this didnt work for you. I had been testing postgresql with many schemas, but only one mysql instance.
Cheers, Russ
Patch to support multiple MySQL databases with Trac