/**
* Fix up integer. Fixes problem with MySQL integer descriptions.
* On MySQL 8 display length is not shown anymore.
* This means we have to match e.g. both "int(10) unsigned" and
* "int unsigned", or both "int(11)" and "int" and so on.
* The same applies to the other integer data types "tinyint",
* "smallint", "mediumint" and "bigint".
*
* @param string $type1 the column type
* @param string $type2 the column attributes
*
* @return string The original or changed column type.
*
* @since 2.5
*/
private function fixInteger($type1, $type2)
{
$result = $type1;
if (preg_match('/^(?P<type>(big|medium|small|tiny)?int)(\\([0-9]+\\))?$/i', $type1, $matches)) {
$result = strtolower($matches['type']);
}
if (strtolower(substr($type2, 0, 8)) === 'unsigned') {
$result .= ' unsigned';
}
return $result;
}