[Rt-commit] rt branch 5.0/fix-5-0-4-custom-roles-upgrade-bug created. rt-5.0.4-115-ge95bb60351
BPS Git Server
git at git.bestpractical.com
Thu Aug 24 15:30:21 UTC 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/fix-5-0-4-custom-roles-upgrade-bug has been created
at e95bb6035185e8a1fbbd5e627332a95f3752c6b7 (commit)
- Log -----------------------------------------------------------------
commit e95bb6035185e8a1fbbd5e627332a95f3752c6b7
Author: Brad Embree <brad at bestpractical.com>
Date: Thu Aug 24 08:16:38 2023 -0700
Add LookupType method to fix custom roles upgrade bug
If upgrading from 4.4.1 or previous and database has a custom role the
4.4.2 upgrade step fails as the 5.0.4 code expects the LookupType column
to exist in the database.
Add a LookupType method that attempts to call LookupType on its parent
class and if there is no result default to the only possible value for
older databases.
diff --git a/lib/RT/CustomRole.pm b/lib/RT/CustomRole.pm
index ec37402925..eb047df48c 100644
--- a/lib/RT/CustomRole.pm
+++ b/lib/RT/CustomRole.pm
@@ -74,6 +74,27 @@ Returns table name for records of this class
sub Table {'CustomRoles'}
+=head2 LookupType
+
+Returns the lookup type for records of this class
+
+=cut
+
+sub LookupType {
+ my $self = shift;
+
+ # LookupType column might not exist in older databases
+ my $type = '';
+ eval {
+ $type = $self->SUPER::LookupType(@_);
+ };
+ # if no type found default to the only possibility for older databases
+ $type = 'RT::Queue-RT::Ticket'
+ unless $type;
+
+ return $type;
+}
+
=head2 Create PARAMHASH
Create takes a hash of values and creates a row in the database:
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list