Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/schema/PhabricatorConfigColumnSchema.php
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | public function getKeyByteLength() { | ||||
$type = $this->getColumnType(); | $type = $this->getColumnType(); | ||||
$matches = null; | $matches = null; | ||||
if (preg_match('/^varchar\((\d+)\)$/', $type, $matches)) { | if (preg_match('/^varchar\((\d+)\)$/', $type, $matches)) { | ||||
// For utf8mb4, each character requires 4 bytes. | // For utf8mb4, each character requires 4 bytes. | ||||
return ((int)$matches[1]) * 4; | return ((int)$matches[1]) * 4; | ||||
} | } | ||||
$matches = null; | |||||
if (preg_match('/^char\((\d+)\)$/', $type, $matches)) { | |||||
// We use char() only for fixed-length binary data, so its size | |||||
// is always the column size. | |||||
return ((int)$matches[1]); | |||||
} | |||||
switch ($type) { | switch ($type) { | ||||
case 'int(10) unsigned': | case 'int(10) unsigned': | ||||
return 4; | return 4; | ||||
} | } | ||||
// TODO: Build this out to catch overlong indexes. | // TODO: Build this out to catch overlong indexes. | ||||
return 0; | return 0; | ||||
Show All 31 Lines |