public static function typeDef(string $type) {
        // Check for the unsigned signifier.
        $unsigned = null;
        if ($type[0] === 'u') {
            $unsigned = true;
            $type = substr($type, 1);
        } elseif (preg_match('`(.+)\s+unsigned`i', $type, $m)) {
            $unsigned = true;
            $type = $m[1];
        }

        // Remove brackets from the type.
        $brackets = null;
        if (preg_match('`^(.*)\((.*)\)$`', $type, $m)) {
            $brackets = $m[2];
            $type = $m[1];
        }

        // Look for the type.
        $type = strtolower($type);
        if (isset(self::$types[$type])) {
            $row = self::$types[$type];
            $dbtype = $type;

            // Resolve an alias.
            if (is_string($row)) {
                $dbtype = $row;
                $row = self::$types[$row];
            }
        } else {
            return null;
        }

        // Now that we have a type row we can build a schema for it.
        $schema = [
            'type' => $row['type'],
            'dbtype' => $dbtype
        ];

        if (!empty($row['schema'])) {
            $schema += $row['schema'];
        }

        if ($row['type'] === 'integer' && $unsigned) {
            $schema['unsigned'] = true;

            if (!empty($schema['maximum'])) {
                $schema['maximum'] = $schema['maximum'] * 2 + 1;
                $schema['minimum'] = 0;
            }
        }

        if (!empty($row['length'])) {
            $schema['maxLength'] = (int)$brackets ?: 255;
        }

        if (!empty($row['precision'])) {
            $parts = array_map('trim', explode(',', $brackets));
            $schema['precision'] = (int)$parts[0];
            if (isset($parts[1])) {
                $schema['scale'] = (int)$parts[1];
            }
        }

        if (!empty($row['enum'])) {
            $enum = explode(',', $brackets);
            $schema['enum'] = array_map(function ($str) {
                return trim($str, "'\" \t\n\r\0\x0B");
            }, $enum);
        }

        return $schema;
    }