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

Aaron Trevena ast at bestpractical.com
Thu Jul 9 07:46:17 EDT 2020


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

- Log -----------------------------------------------------------------
commit f32e56725b7d8a8c11d9a8c89a0859a417746a66
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 6950a615ebd907fbf9d023771a47a8925c049981
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
    
    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

diff --git a/docs/UPGRADING-5.0 b/docs/UPGRADING-5.0
index e82a5670d0..56f5d77de7 100644
--- a/docs/UPGRADING-5.0
+++ b/docs/UPGRADING-5.0
@@ -58,6 +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.
 
+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 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
 
 =head2 Notable Changes
diff --git a/etc/upgrade/4.5.8/content b/etc/upgrade/4.5.8/content
index 3b9ba9f040..0b06ce016a 100644
--- a/etc/upgrade/4.5.8/content
+++ b/etc/upgrade/4.5.8/content
@@ -6,13 +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');
 
-    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';
@@ -25,6 +25,7 @@ push @Final, sub {
             warn "failed to update fulltext search table $table key to bigint : $@ : " . $dbh->errstr
         }
     }
+    return 1;
 };
 
 ###
@@ -36,7 +37,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 {

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


More information about the rt-commit mailing list