to reproduce:
- create a new environment with sqlite database
- follow setup instructions
- trac-admin /some/env upgrade output looks good
- run trac-admin /some/env upgrade a second time
- upgrade assumes a full install is needed for lack of TimingAndEstimationPlugin_Db_Version
- upgrade fails creating the billing table a second time
narrowed down cause:
- dbhelper::db_table_exists() called by CustomReportManager::upgrade() somehow causes the system table entry for TimingAndEstimationPlugin_Db_Version to be rolled back.
- since it's a fresh install there is no custom_report table
- dbhelper::db_table_exists() correctly returns false in the response to the exception for select from the non-existent table - but has the side effect of rolling back
- absence of the db version entry causes upgrade checks to assume full install is required again
FWIW:
| trac | 0.12.2
|
| python | 2.5.2
|
| sqlite | 3.4.2
|
We will live for now - since we'll be using sqlite for the foreseeable future, we just made dbhelper::db_table_exists() return early as follows:
def db_table_exists(env, table):
return get_scalar(env, ("select count(*) from sqlite_master where type = 'table' and name = '%s'" % (table))) > 0;
Obviously not a viable solution, but could be made conditional if
- dbhelper can query database backend
- nested transactions as used by dbhelper fail only for sqlite
As such it would serve as a work around for many environments
Sorry if notation is substandard - spent half as much time looking at python code today as I have in entire my career prior - when I read 'dive into python' years ago ;)
Thanks for a plugin worth debugging!