protected static function dbType(array $typeDef) {
        $dbtype = $typeDef['dbtype'];

        if (!empty($typeDef['maxLength'])) {
            $dbtype .= "({$typeDef['maxLength']})";
        } elseif (!empty($typeDef['unsigned'])) {
            $dbtype = 'u'.$dbtype;
        } elseif (!empty($typeDef['precision'])) {
            $dbtype .= "({$typeDef['precision']}";
            if (!empty($typeDef['scale'])) {
                $dbtype .= ",{$typeDef['scale']}";
            }
            $dbtype .= ')';
        } elseif (!empty($typeDef['enum'])) {
            $parts = array_map(function ($str) {
                return "'{$str}'";
            }, $typeDef['enum']);
            $dbtype .= '('.implode(',', $parts).')';
        }
        return $dbtype;
    }