diff options
-rw-r--r-- | libraries/classes/Types.php | 11 | ||||
-rw-r--r-- | libraries/classes/Util.php | 7 |
2 files changed, 17 insertions, 1 deletions
diff --git a/libraries/classes/Types.php b/libraries/classes/Types.php index 12f7a7e4cf..e2deae064d 100644 --- a/libraries/classes/Types.php +++ b/libraries/classes/Types.php @@ -713,13 +713,22 @@ class Types */ public function getAttributes() { - return [ + $isMariaDB = $this->dbi->isMariaDB(); + $serverVersion = $this->dbi->getVersion(); + + $attributes = [ '', 'BINARY', 'UNSIGNED', 'UNSIGNED ZEROFILL', 'on update CURRENT_TIMESTAMP', ]; + + if ($isMariaDB && $serverVersion >= 100100) { + $attributes[] = 'COMPRESSED=zlib'; + } + + return $attributes; } /** diff --git a/libraries/classes/Util.php b/libraries/classes/Util.php index 8338d8e003..0d39ca8bae 100644 --- a/libraries/classes/Util.php +++ b/libraries/classes/Util.php @@ -1373,6 +1373,7 @@ class Util $binary = false; $unsigned = false; $zerofill = false; + $compressed = false; } else { $enumSetValues = []; @@ -1394,6 +1395,8 @@ class Util $zerofill = ($zerofillCount > 0); $printType = (string) preg_replace('@unsigned@', '', $printType, -1, $unsignedCount); $unsigned = ($unsignedCount > 0); + $printType = (string) preg_replace('@\/\*!100301 compressed\*\/@', '', $printType, -1, $compressedCount); + $compressed = ($compressedCount > 0); $printType = trim($printType); } @@ -1410,6 +1413,10 @@ class Util $attribute = 'UNSIGNED ZEROFILL'; } + if ($compressed) { + $attribute = 'COMPRESSED=zlib'; + } + $canContainCollation = false; if (! $binary && preg_match('@^(char|varchar|text|tinytext|mediumtext|longtext|set|enum)@', $type)) { $canContainCollation = true; |