[Rt-commit] rt branch 5.0-releng/mysql-unquote-index-name created. rt-5.0.4beta1-7-g98c7202d26
BPS Git Server
git at git.bestpractical.com
Wed May 3 15:55:03 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-releng/mysql-unquote-index-name has been created
at 98c7202d2654b5ce453a4465005bd06683f9f2de (commit)
- Log -----------------------------------------------------------------
commit 98c7202d2654b5ce453a4465005bd06683f9f2de
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed May 3 22:54:34 2023 +0800
Fix the partially quoted index name for MariaDB/MySQL
Previously the index name was generated with quoted table name and a
number suffix like "`attachments`1", which MariaDB/MySQL does not
support.
As index names(table name + number suffix) probably will never be
reserved words, this commit simply removes the quote of the table name
part.
This is initially to fix upgrade steps that create indexes via "indexes"
file.
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index c8732a980f..f9dc58fd88 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -2249,8 +2249,13 @@ sub CreateIndex {
my $self = shift;
my %args = ( Table => undef, Name => undef, Columns => [], CaseInsensitive => {}, @_ );
+ my $quoted_table; # Quoted table only for mysql.
if (RT->Config->Get('DatabaseType') eq 'mysql') {
- $args{'Table'} = $self->QuoteName( $self->_CanonicTableNameMysql( $args{'Table'} ));
+ $args{'Table'} = $self->_CanonicTableNameMysql( $args{'Table'} );
+ $quoted_table = $self->QuoteName($args{'Table'});
+ }
+ else {
+ $quoted_table = $args{'Table'};
}
my $name = $args{'Name'};
@@ -2270,9 +2275,10 @@ sub CreateIndex {
}
}
+
my $sql = "CREATE"
. ($args{'Unique'}? ' UNIQUE' : '')
- ." INDEX $name ON $args{'Table'}"
+ ." INDEX $name ON $quoted_table"
."(". join( ', ', @columns ) .")"
;
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list