[Rt-commit] rt branch, 4.4/queue-sortorder-error, created. rt-4.4.0-182-g776bb9c

Shawn Moore shawn at bestpractical.com
Mon May 16 18:40:53 EDT 2016


The branch, 4.4/queue-sortorder-error has been created
        at  776bb9ca1a84fca9cad03a7641882a3b187b6dbc (commit)

- Log -----------------------------------------------------------------
commit 776bb9ca1a84fca9cad03a7641882a3b187b6dbc
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Mon May 16 22:32:36 2016 +0000

    Add queue.sortorder column sooner in the 4.4 upgrade
    
    This fixes errors during the upgrade from RT 4.2 to RT 4.4 while RTIR
    3.2 is installed. RTIR 3.2.0 provides a RT::Queue::HasRight which
    includes the following code:
    
        my $queues = RT::Queues->new( RT->SystemUser );
        $queues->Limit( FIELD => 'Name', OPERATOR => 'STARTSWITH', VALUE => "$name - ", CASESENSITIVE => 0 );
        $equiv_objects = $queues->ItemsArrayRef;
    
    However, enumerating the list of queues like this is broken (throwing
    database error "column main.sortorder does not exist") with the RT 4.4
    codebase _until_ the sortorder column is added to the queue table schema
    in upgrade step 4.3.4.  The upgrade step that tickles this error is
    4.3.2 which itself handled the issue by emptying out the default sort
    order for queues like so:
    
        # override the default order by SortOrder, because it doesn't exist yet
        $queues->OrderByCols();
    
    Unfortunately adding such a hack doesn't make much sense for RTIR, and
    it's too late anyway since it'd need to have been included in RTIR
    3.2.0, since users upgrade RT first then RTIR.  So instead, move the
    schema change adding queue.sortorder to be part of the 4.3.2 upgrade
    step. This obviates the need for the above hack (since 4.3.2/schema is
    run before 4.3.2/content), and allows the RTIR HasRight override to run
    correctly during the RT upgrade.
    
    This specific solution was chosen (rather than reordering 4.3.2, 4.3.3,
    and 4.3.4) to be the least disruptive and different for installations
    upgrading from RT 4.2 to 4.4.0 vs 4.4.1.

diff --git a/etc/upgrade/4.3.2/content b/etc/upgrade/4.3.2/content
index 9673e6c..3cfadfe 100644
--- a/etc/upgrade/4.3.2/content
+++ b/etc/upgrade/4.3.2/content
@@ -7,8 +7,6 @@ our @Initial = (
         my $queues = RT::Queues->new(RT->SystemUser);
         $queues->UnLimit;
         $queues->{'find_disabled_rows'} = 1;
-        # override the default order by SortOrder, because it doesn't exist yet
-        $queues->OrderByCols();
         while ( my $queue = $queues->Next ) {
             next if $queue->FirstAttribute('DefaultValues');
             my %default;
diff --git a/etc/upgrade/4.3.4/schema.Oracle b/etc/upgrade/4.3.2/schema.Oracle
similarity index 100%
rename from etc/upgrade/4.3.4/schema.Oracle
rename to etc/upgrade/4.3.2/schema.Oracle
diff --git a/etc/upgrade/4.3.4/schema.Pg b/etc/upgrade/4.3.2/schema.Pg
similarity index 100%
rename from etc/upgrade/4.3.4/schema.Pg
rename to etc/upgrade/4.3.2/schema.Pg
diff --git a/etc/upgrade/4.3.4/schema.SQLite b/etc/upgrade/4.3.2/schema.SQLite
similarity index 100%
rename from etc/upgrade/4.3.4/schema.SQLite
rename to etc/upgrade/4.3.2/schema.SQLite
diff --git a/etc/upgrade/4.3.4/schema.mysql b/etc/upgrade/4.3.2/schema.mysql
similarity index 100%
rename from etc/upgrade/4.3.4/schema.mysql
rename to etc/upgrade/4.3.2/schema.mysql

-----------------------------------------------------------------------


More information about the rt-commit mailing list