diff options
author | TechSneeze <dave@techsneeze.com> | 2022-01-16 10:08:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-16 10:08:48 +0300 |
commit | 2af80e6a0ccc57bfe4e6bc8ae11c15b435c3d919 (patch) | |
tree | 9bc545847816b5a1fcffac1b3675bd244e21d1b0 | |
parent | e07bb49f9630e982c26eedf0f26a654d660b3bea (diff) | |
parent | b74c4ea85fa2910d9d479a18da8a516756fd85a8 (diff) |
Merge pull request #103 from gutmensch/roschumann-mysql8-display-width-compat
Fixes #102
-rwxr-xr-x | dmarcts-report-parser.pl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/dmarcts-report-parser.pl b/dmarcts-report-parser.pl index 6c4264a..7164c26 100755 --- a/dmarcts-report-parser.pl +++ b/dmarcts-report-parser.pl @@ -1053,10 +1053,14 @@ sub storeXMLInDatabase { sub checkDatabase { my $dbh = $_[0]; + # display width is deprecated in MySQL 8+ and will not be shown in show create statements + my $mysql_main_version = $dbh->selectrow_array("SELECT SUBSTRING_INDEX(VERSION(), '.', 1);") || 5; + my $display_width = ( $mysql_main_version <= 5 ? "(10)" : "" ); + my %tables = ( "report" => { column_definitions => [ - "serial" , "int(10) unsigned NOT NULL AUTO_INCREMENT", + "serial" , "int${ display_width } unsigned NOT NULL AUTO_INCREMENT", "mindate" , "timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", "maxdate" , "timestamp NULL", "domain" , "varchar(255) NOT NULL", @@ -1076,11 +1080,11 @@ sub checkDatabase { }, "rptrecord" =>{ column_definitions => [ - "id" , "int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY", - "serial" , "int(10) unsigned NOT NULL", - "ip" , "int(10) unsigned", + "id" , "int${ display_width } unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY", + "serial" , "int${ display_width } unsigned NOT NULL", + "ip" , "int${ display_width } unsigned", "ip6" , "binary(16)", - "rcount" , "int(10) unsigned NOT NULL", + "rcount" , "int${ display_width } unsigned NOT NULL", "disposition" , "enum('" . join("','", ALLOWED_DISPOSITION) . "')", "reason" , "varchar(255)", "dkimdomain" , "varchar(255)", |