Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/schema/PhabricatorConfigSchemaSpec.php
Show First 20 Lines • Show All 224 Lines • ▼ Show 20 Lines | private function getDetailsForDataType($data_type) { | ||||
// If the type ends with "?", make the column nullable. | // If the type ends with "?", make the column nullable. | ||||
$nullable = false; | $nullable = false; | ||||
if (preg_match('/\?$/', $data_type)) { | if (preg_match('/\?$/', $data_type)) { | ||||
$nullable = true; | $nullable = true; | ||||
$data_type = substr($data_type, 0, -1); | $data_type = substr($data_type, 0, -1); | ||||
} | } | ||||
// NOTE: MySQL allows fragments like "VARCHAR(32) CHARACTER SET binary", | |||||
// but just interprets that to mean "VARBINARY(32)". The fragment is | |||||
// totally disallowed in a MODIFY statement vs a CREATE TABLE statement. | |||||
switch ($data_type) { | switch ($data_type) { | ||||
case 'id': | case 'id': | ||||
case 'epoch': | case 'epoch': | ||||
case 'uint32': | case 'uint32': | ||||
$column_type = 'int(10) unsigned'; | $column_type = 'int(10) unsigned'; | ||||
break; | break; | ||||
case 'sint32': | case 'sint32': | ||||
$column_type = 'int(10)'; | $column_type = 'int(10)'; | ||||
break; | break; | ||||
case 'id64': | case 'id64': | ||||
case 'uint64': | case 'uint64': | ||||
$column_type = 'bigint(20) unsigned'; | $column_type = 'bigint(20) unsigned'; | ||||
break; | break; | ||||
case 'sint64': | case 'sint64': | ||||
$column_type = 'bigint(20)'; | $column_type = 'bigint(20)'; | ||||
break; | break; | ||||
case 'phid': | case 'phid': | ||||
case 'policy'; | case 'policy'; | ||||
$column_type = 'varchar(64)'; | $column_type = 'varbinary(64)'; | ||||
$charset = 'binary'; | |||||
$collation = 'binary'; | |||||
break; | break; | ||||
case 'bytes64': | case 'bytes64': | ||||
$column_type = 'char(64)'; | $column_type = 'binary(64)'; | ||||
$charset = 'binary'; | |||||
$collation = 'binary'; | |||||
break; | break; | ||||
case 'bytes40': | case 'bytes40': | ||||
$column_type = 'char(40)'; | $column_type = 'binary(40)'; | ||||
$charset = 'binary'; | |||||
$collation = 'binary'; | |||||
break; | break; | ||||
case 'bytes32': | case 'bytes32': | ||||
$column_type = 'char(32)'; | $column_type = 'binary(32)'; | ||||
$charset = 'binary'; | |||||
$collation = 'binary'; | |||||
break; | break; | ||||
case 'bytes20': | case 'bytes20': | ||||
$column_type = 'char(20)'; | $column_type = 'binary(20)'; | ||||
$charset = 'binary'; | |||||
$collation = 'binary'; | |||||
break; | break; | ||||
case 'bytes12': | case 'bytes12': | ||||
$column_type = 'char(12)'; | $column_type = 'binary(12)'; | ||||
$charset = 'binary'; | |||||
$collation = 'binary'; | |||||
break; | break; | ||||
case 'bytes4': | case 'bytes4': | ||||
$column_type = 'char(4)'; | $column_type = 'binary(4)'; | ||||
$charset = 'binary'; | |||||
$collation = 'binary'; | |||||
break; | break; | ||||
case 'bytes': | case 'bytes': | ||||
$column_type = 'longblob'; | $column_type = 'longblob'; | ||||
break; | break; | ||||
case 'text255': | case 'text255': | ||||
$column_type = 'varchar(255)'; | $column_type = 'varchar(255)'; | ||||
$charset = $this->getUTF8Charset(); | $charset = $this->getUTF8Charset(); | ||||
$collation = $this->getUTF8Collation(); | $collation = $this->getUTF8Collation(); | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |