Commit 930ec9af authored by Jasper N. Brouwer's avatar Jasper N. Brouwer Committed by Alexander

Fixed max length of MySql TEXT type declaration

This should be 65535 (2 ^ 16 - 1) in stead of 65532.
Modified docblock to show the max lengths.
parent 71589391
...@@ -193,17 +193,26 @@ class MySqlPlatform extends AbstractPlatform ...@@ -193,17 +193,26 @@ class MySqlPlatform extends AbstractPlatform
} }
/** /**
* {@inheritDoc} * Gets the SQL snippet used to declare a CLOB column type.
* TINYTEXT : 2 ^ 8 - 1 = 255
* TEXT : 2 ^ 16 - 1 = 65535
* MEDIUMTEXT : 2 ^ 24 - 1 = 16777215
* LONGTEXT : 2 ^ 32 - 1 = 4294967295
*
* @param array $field
*
* @return string
*/ */
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $field)
{ {
if ( ! empty($field['length']) && is_numeric($field['length'])) { if ( ! empty($field['length']) && is_numeric($field['length'])) {
$length = $field['length']; $length = $field['length'];
if ($length <= 255) { if ($length <= 255) {
return 'TINYTEXT'; return 'TINYTEXT';
} }
if ($length <= 65532) { if ($length <= 65535) {
return 'TEXT'; return 'TEXT';
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment