Upgrade from 5.0.1 -> 5.0.5: Table 'shorteners' already exists

Greetings,

I am new to admin’ing an RT server and was given the task to move RT from an old VM to a new VM, and in doing so, I did a clean install from scratch.

I am using FreeBSD 14, the rt50-5.0.5_1 package and the mysql80-server-8.0.35_1 package.

I followed the docs at System administration/Database - RT 5.0.5 Documentation - Best Practical to backup the old database and restore it to the new server.

Using the following commend, I incrementally updated the DB from 5.0.1 → 5.0.2 → 5.0.3 → 5.0.4 and it’s during the last upgrade where it failed:

# /usr/local/sbin/rt-setup-database \
     --datadir /usr/local/share/doc/rt50/upgrade \
     --action upgrade --prompt-for-dba-password

And it gives me the following error:

Processing 5.0.4
Now populating database schema.
[95146] [Fri Jul 12 19:26:49 2024] [critical]: DBD::mysql::st execute failed: Table 'shorteners' already exists at /usr/local/lib/perl5/site_perl/RT/Handle.pm line 570. (/usr/local/lib/perl5/site_perl/RT.pm:409)
DBD::mysql::st execute failed: Table 'shorteners' already exists at /usr/local/lib/perl5/site_perl/RT/Handle.pm line 570.

And this is what I see when I look at the RT upgrade history:

At this point I am stuck and don’t know how to proceed, any help / pointers would be greatly appreciated.

Thank you,
Justin

Hey,

The shorteners table is only created in 5.0.4 upgrade, so that is certainly curious. A quick fix is probably to drop that table and try again. The patch being applied to the database is likely in /usr/local/share/doc/rt50/upgrade/5.0.4/schema.mysql .

Just to be on the safe side I’d probably:

a) back up the database!

b) rather than drop the table rename it temporarily: RENAME shorteners TO shorteners_old

That way if you find you do need data in the table you can get it back relatively easily after the upgrade.

Did I mention backing up the database? :slight_smile: