#11859 closed enhancement (fixed)
Add get_database_version and set_database_version methods to DatabaseManager class
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.1.3 |
Component: | database backend | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: |
The database version for Trac and plugins can be retrieved using the |
||
Internal Changes: |
Description
As an incremental step towards the changes outlined in #8172, I propose to add get_database_version
and set_database_version
methods to the DatabaseManager
class.
I implemented these changes as part of another ticket and ended up not needing them, so it seemed worthwhile to commit the changes as a refactoring and database API enhancement.
Attachments (0)
Change History (8)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Status: | new → assigned |
---|
comment:3 by , 10 years ago
API Changes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Tests pass with SQLite, MySQL and PostgreSQL. Added docstrings.
Committed to trunk in [13455]. Documented in TracDev/ApiChanges/1.1.3@14.
comment:4 by , 10 years ago
It seems to be a given that I'll break the build on commit, despite all the test runs passing locally. make Trac.egg-info compile unit-test functional-test
passes for me. The database should be destroyed because database_version
was incremented and no longer matches db_default
, however the following error is seen in the automated builds:
OperationalError: table system already exists
I put a workaround in place in [13460], which is probably better anyway since the tests will run slightly faster.
follow-up: 6 comment:5 by , 10 years ago
DatabaseManager(self) should be DatabaseManager(self.env)
or you get AssertionError: First argument must be a ComponentManager instance
because here self
is EnvironmentSetup(Component)
, not Environment(ComponentManager)
.
comment:6 by , 10 years ago
Replying to psuter:
DatabaseManager(self) should be
DatabaseManager(self.env)
Committed in [13462].
I haven't tested the changes yet with MySQL and PostgreSQL. Docstrings need to be added as well.