function getTypeRepresentation(DBType $dbType) { switch ($dbType->getValue()) { case DBType::BOOLEAN: return $this->compute('TINYINT(1) UNSIGNED', $dbType->isNullable()); case DBType::BINARY: $size = $dbType->getSize(); if ($size < 65535) { $customType = 'BLOB'; } else { if ($size < 16777215) { $customType = 'MEDIUMBLOB'; } else { $customType = 'LONGTBLOB'; } } return $this->compute($customType, $dbType->isNullable()); case DBType::VARCHAR: $size = $dbType->getSize(); if (!$size) { $dbType->setSize(255); } else { if ($size > 255) { if ($size < 65535) { $customType = 'TEXT'; } else { if ($size < 16777215) { $customType = 'MEDIUMTEXT'; } else { $customType = 'LONGTEXT'; } } return $this->compute($customType, $dbType->isNullable()); } } } $type = parent::getTypeRepresentation($dbType); if ($dbType->isGenerated()) { $type .= ' AUTO_INCREMENT'; } return $type; }
/** * @return string */ function getTypeRepresentation(DBType $type) { $names = $this->typeNames[$type->getValue()]; return $this->getComputedTypeRepresentation($names, $type); }