id,summary,reporter,owner,description,type,status,priority,component,severity,resolution,keywords,cc,release
9250,fresh install rolls back TimingAndEstimationPlugin_Db_Version in system table in sqlite,pks@moxune.com,bobbysmith007,to reproduce:\r\n\r\n * create a new environment with sqlite database\r\n * follow setup instructions\r\n   * {{{trac-admin /some/env upgrade}}} output looks good\r\n * run {{{trac-admin /some/env upgrade}}} a second time\r\n   * upgrade assumes a full install is needed for lack of {{{TimingAndEstimationPlugin_Db_Version}}}\r\n   * upgrade fails creating the billing table a second time\r\n\r\nnarrowed down cause:\r\n * {{{dbhelper::db_table_exists()}}} called by {{{CustomReportManager::upgrade()}}} somehow causes the {{{system}}} table entry for {{{TimingAndEstimationPlugin_Db_Version}}} to be rolled back.\r\n * since it's a fresh install there is no {{{custom_report}}} table\r\n * {{{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\r\n * absence of the db version entry causes upgrade checks to assume full install is required again\r\n\r\nFWIW:\r\n\r\n|| trac || 0.12.2 ||\r\n|| python || 2.5.2 ||\r\n|| sqlite || 3.4.2 ||\r\n\r\nWe 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: \r\n\r\n{{{\r\n#!python\r\ndef db_table_exists(env_  table):\r\n    return get_scalar(env_ ("select count(*) from sqlite_master where type = 'table' and name = '%s'" % (table))) > 0;\r\n}}}\r\n\r\nObviously not a viable solution_ but could be made conditional if\r\n * {{{dbhelper}}} can query database backend\r\n * nested transactions as used by {{{dbhelper}}} fail only for sqlite\r\nAs such it would serve as a work around for many environments\r\n\r\nSorry 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 ;)\r\n\r\nThanks for a plugin worth debugging!,defect,closed,lowest,TimingAndEstimationPlugin,normal,wontfix,install upgrade dbhelper sqlite,,0.12
