Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#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 get_database_version and set_database_version methods of the DatabaseManager class.

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 Ryan J Ollos, 9 years ago

I haven't tested the changes yet with MySQL and PostgreSQL. Docstrings need to be added as well.

log:rjollos.git:t11859

comment:2 by Ryan J Ollos, 9 years ago

Status: newassigned

comment:3 by Ryan J Ollos, 9 years ago

API Changes: modified (diff)
Resolution: fixed
Status: assignedclosed

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 Ryan J Ollos, 9 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.

Last edited 9 years ago by Ryan J Ollos (previous) (diff)

comment:5 by Peter Suter, 9 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).

in reply to:  5 comment:6 by Peter Suter, 9 years ago

Replying to psuter:

DatabaseManager(self) should be DatabaseManager(self.env)

Committed in [13462].

comment:7 by Ryan J Ollos, 9 years ago

Thanks, I'll look into adding some test coverage for that.

comment:8 by Ryan J Ollos, 9 years ago

Minor refactoring in [13574].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.