Avoid querying IntegrationConfig from older databases during upgrade.

Review Request #12772 — Created Jan. 7, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

The database upgrade code looks for SCMTool-related state to migrate
over to SCMTool IDs, and one of the places where it looks is
IntegrationConfig.

The problem is, this assumes IntegrationConfig was installed in the
database prior to upgrade. That breaks upgrades from Review Board 2.5
and older.

This change fixes up that assumption by first querying a list of all
known tables in the database as the first pre-upgrade step. Any code
that's sensitive to the presence of tables (ones that haven't been
around since 1.0) now checks for presence before doing anything that
would touch the database.

Existing code that used DatabaseError to determine if tables existed
have been updated to use this mechanism. This leaves DatabaseError
free to bubble up, so we can catch other types of errors.

Tested upgrading from 2.5, 3.0, 4.0, and 5.0 databases using both
./reviewboard/manage.py and rb-site upgrade.

Tested installing a new database.

Commits

Files

    Loading...