Edgewall Software

Opened 4 years ago

Closed 4 years ago

Last modified 21 months 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:
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.


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 Changed 4 years ago by Ryan J Ollos

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


comment:2 Changed 4 years ago by Ryan J Ollos

Status: newassigned

comment:3 Changed 4 years ago by Ryan J Ollos

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 Changed 4 years ago by Ryan J Ollos

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 4 years ago by Ryan J Ollos (previous) (diff)

comment:5 Changed 4 years ago by Peter Suter

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 in reply to:  5 Changed 4 years ago by Peter Suter

Replying to psuter:

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

Committed in [13462].

comment:7 Changed 4 years ago by Ryan J Ollos

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

comment:8 Changed 4 years ago by Ryan J Ollos

Minor refactoring in [13574].

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted.
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.