From d7e5fb03442edf555267dda852b0bb432a879713 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 16 Mar 2023 12:57:13 +0000 Subject: [PATCH] Bug 32334: (follow-up) Fix for bug 31028, introducing IF NOT EXISTS We need to expect CREATE TABLE IF NOT EXISTS now in kohastructure. Test plan: Run misc/maintenance/sync_db_comments.pl -reset Signed-off-by: Marcel de Rooy Signed-off-by: David Nind Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- Koha/Database/Commenter.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/Database/Commenter.pm b/Koha/Database/Commenter.pm index 9ce562ff94..2b37067c76 100644 --- a/Koha/Database/Commenter.pm +++ b/Koha/Database/Commenter.pm @@ -182,9 +182,9 @@ sub _fetch_schema_comments { my $info = {}; my $current_table = q{}; foreach my $line ( @schema_lines ) { - if( $line =~ /^CREATE TABLE `?(\w+)`?/ ) { + if( $line =~ /^CREATE TABLE\s*(?:IF NOT EXISTS)?\s*`?(\w+)`?/ ) { $current_table = $1; - } elsif( $line =~ /^\s+`?(\w+)`?.*COMMENT ['"](.+)['"][,)]?$/ ) { + } elsif( $current_table && $line =~ /^\s+`?(\w+)`?.*COMMENT ['"](.+)['"][,)]?$/ ) { my ( $col, $comment ) = ( $1, $2 ); $comment =~ s/''/'/g; # we call quote later on $info->{$current_table}->{$col} = $comment; -- 2.39.5