[Rt-commit] rt branch, 5.0/convert-fulltextsearch-utf8mb4, created. rt-5.0.0beta1-46-g762087b030

Aaron Trevena ast at bestpractical.com
Thu Jul 9 07:01:35 EDT 2020


The branch, 5.0/convert-fulltextsearch-utf8mb4 has been created
        at  762087b030b6d09af7045285d34ce6456136bc2f (commit)

- Log -----------------------------------------------------------------
commit fb59da120ce967900fb4be1e14e643082a7beb15
Author: Aaron Trevena <ast at bestpractical.com>
Date:   Tue Jun 30 19:19:00 2020 +0100

    Update fulltextsearch table to new utf8mb4 charset
    
    Add table encoding change for fulltextsearch table in
    upgrade script for 4.5.7

diff --git a/docs/UPGRADING-5.0 b/docs/UPGRADING-5.0
index bbf7f175c8..985917b873 100644
--- a/docs/UPGRADING-5.0
+++ b/docs/UPGRADING-5.0
@@ -58,8 +58,11 @@ while running because MySQL, MariaDB, and Postgres will create a
 temporary copy of the table while running. If you don't have sufficient
 space, it can cause this step to fail.
 
-You can skip this step by setting NoBigintUpgrade to 1 in the $FullTextSearch
-section of your RT configuration.
+If you have Fulltext searching enabled in mysql, mariadb or postgres this
+step can require a significantly large amount of disk space and you can skip
+this step for the fulltexts search index table by setting
+NoFulltextsearchTableUpgrade to 1 in the $FullTextSearch section of your
+RT configuration.
 
 =back
 
diff --git a/etc/upgrade/4.5.8/content b/etc/upgrade/4.5.8/content
index 19ddfc9133..6bedd6a907 100644
--- a/etc/upgrade/4.5.8/content
+++ b/etc/upgrade/4.5.8/content
@@ -14,7 +14,7 @@ push @Final, sub {
 
     # check we don't have a flag or config to not upgrade to bigint as the
     # size of tables could be large and users may want to do this as a seperate step
-    return if ($fts_config->{'NoBigintUpgrade'} or $ENV{NO_BIGINT_UPGRADE});
+    return if ($fts_config->{'NoFulltextsearchTableUpgrade'});
 
     my $dbh = RT->DatabaseHandle->dbh;
 
@@ -40,7 +40,7 @@ sub get_pg_ddl_query {
 
 sub get_mysql_ddl_query {
     my ($table) = @_;
-    return "ALTER TABLE $table MODIFY id BIGINT NOT NULL AUTO_INCREMENT;";
+    return "ALTER TABLE $table MODIFY id BIGINT NOT NULL AUTO_INCREMENT, CONVERT TO CHARACTER SET utf8mb4;";
 }
 
 sub table_exists {

commit 225b999635db85dcc74aa4104dd5aa2a3a12d001
Author: Aaron Trevena <ast at bestpractical.com>
Date:   Thu Jul 2 14:19:27 2020 +0100

    Provide admin dbh to upgrade perl scripts

diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index c3391f0445..6d98cb2c13 100644
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -383,8 +383,8 @@ sub action_insert {
 
     RT->System->AddUpgradeHistory($package => \%upgrade_data);
 
+    $RT::Handle::admin_dbh = get_admin_dbh();
     my @ret;
-
     my $upgrade = sub { @ret = $RT::Handle->InsertData( $file, $root_password ) };
 
     for my $file (@{$args{backcompat} || []}) {

commit 762087b030b6d09af7045285d34ce6456136bc2f
Author: Aaron Trevena <ast at bestpractical.com>
Date:   Thu Jul 2 14:22:13 2020 +0100

    Updated upgrade script for fulltextsearch tables
    
    Use RT::Handle admin dbh added to RT::Handle by rt-setup-database script
    in content perl script to ensure we have permission to alter db tables
    
    Remove flag to skip upgrading the fulltextsearch table, and update
    documentation accordingly

diff --git a/docs/UPGRADING-5.0 b/docs/UPGRADING-5.0
index 985917b873..56f5d77de7 100644
--- a/docs/UPGRADING-5.0
+++ b/docs/UPGRADING-5.0
@@ -60,9 +60,8 @@ space, it can cause this step to fail.
 
 If you have Fulltext searching enabled in mysql, mariadb or postgres this
 step can require a significantly large amount of disk space and you can skip
-this step for the fulltexts search index table by setting
-NoFulltextsearchTableUpgrade to 1 in the $FullTextSearch section of your
-RT configuration.
+this step for the fulltexts search index table by skipping the db upgrade in 4.5.8,
+i.e. run make upgrade-database twice, first to 4.5.7 then from 4.5.9
 
 =back
 
diff --git a/etc/upgrade/4.5.8/content b/etc/upgrade/4.5.8/content
index 6bedd6a907..0b06ce016a 100644
--- a/etc/upgrade/4.5.8/content
+++ b/etc/upgrade/4.5.8/content
@@ -6,17 +6,13 @@ our @Final;
 push @Final, sub {
     # skip unless fulltextsearch is enabled
     my $fts_config = RT->Config->Get('FullTextSearch');
-    return unless ($fts_config->{'Enable'});
+    return 1 unless ($fts_config->{'Enable'});
 
     # check config to see if db type is applicable
     my $db_type = RT->Config->Get('DatabaseType');
-    return unless ($db_type eq 'Pg' or $db_type eq 'mysql');
+    return 1 unless ($db_type eq 'Pg' or $db_type eq 'mysql');
 
-    # check we don't have a flag or config to not upgrade to bigint as the
-    # size of tables could be large and users may want to do this as a seperate step
-    return if ($fts_config->{'NoFulltextsearchTableUpgrade'});
-
-    my $dbh = RT->DatabaseHandle->dbh;
+    my $dbh = $RT::Handle::admin_dbh;
 
     # get tablename from config, fall back to default tablename
     my $table = $fts_config->{'Table'} || 'AttachmentsIndex';
@@ -29,6 +25,7 @@ push @Final, sub {
             warn "failed to update fulltext search table $table key to bigint : $@ : " . $dbh->errstr
         }
     }
+    return 1;
 };
 
 ###

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


More information about the rt-commit mailing list