2014-09-18 17:22:54 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class PhabricatorConfigSchemaSpec extends Phobject {
|
|
|
|
|
2014-09-18 17:25:34 +02:00
|
|
|
private $server;
|
|
|
|
private $utf8Charset;
|
2014-10-01 17:18:53 +02:00
|
|
|
private $utf8BinaryCollation;
|
|
|
|
private $utf8SortingCollation;
|
2014-09-18 17:25:34 +02:00
|
|
|
|
2014-10-01 17:18:53 +02:00
|
|
|
public function setUTF8SortingCollation($utf8_sorting_collation) {
|
|
|
|
$this->utf8SortingCollation = $utf8_sorting_collation;
|
2014-09-18 17:25:34 +02:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:18:53 +02:00
|
|
|
public function getUTF8SortingCollation() {
|
|
|
|
return $this->utf8SortingCollation;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setUTF8BinaryCollation($utf8_binary_collation) {
|
|
|
|
$this->utf8BinaryCollation = $utf8_binary_collation;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getUTF8BinaryCollation() {
|
|
|
|
return $this->utf8BinaryCollation;
|
2014-09-18 17:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setUTF8Charset($utf8_charset) {
|
|
|
|
$this->utf8Charset = $utf8_charset;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getUTF8Charset() {
|
|
|
|
return $this->utf8Charset;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setServer(PhabricatorConfigServerSchema $server) {
|
|
|
|
$this->server = $server;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getServer() {
|
|
|
|
return $this->server;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract public function buildSchemata();
|
|
|
|
|
|
|
|
protected function buildLiskSchemata($base) {
|
|
|
|
|
|
|
|
$objects = id(new PhutilSymbolLoader())
|
|
|
|
->setAncestorClass($base)
|
|
|
|
->loadObjects();
|
|
|
|
|
|
|
|
foreach ($objects as $object) {
|
2014-10-01 16:40:36 +02:00
|
|
|
if ($object->getConfigOption(LiskDAO::CONFIG_NO_TABLE)) {
|
|
|
|
continue;
|
|
|
|
}
|
2014-09-18 17:32:44 +02:00
|
|
|
$this->buildLiskObjectSchema($object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function buildTransactionSchema(
|
|
|
|
PhabricatorApplicationTransaction $xaction,
|
|
|
|
PhabricatorApplicationTransactionComment $comment = null) {
|
|
|
|
|
|
|
|
$this->buildLiskObjectSchema($xaction);
|
|
|
|
if ($comment) {
|
|
|
|
$this->buildLiskObjectSchema($comment);
|
|
|
|
}
|
|
|
|
}
|
2014-09-18 17:25:34 +02:00
|
|
|
|
2014-09-19 20:46:44 +02:00
|
|
|
protected function buildCustomFieldSchemata(
|
|
|
|
PhabricatorLiskDAO $storage,
|
|
|
|
array $indexes) {
|
|
|
|
|
|
|
|
$this->buildLiskObjectSchema($storage);
|
|
|
|
foreach ($indexes as $index) {
|
|
|
|
$this->buildLiskObjectSchema($index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-18 17:32:44 +02:00
|
|
|
private function buildLiskObjectSchema(PhabricatorLiskDAO $object) {
|
2014-09-18 17:36:22 +02:00
|
|
|
$this->buildRawSchema(
|
|
|
|
$object->getApplicationName(),
|
|
|
|
$object->getTableName(),
|
|
|
|
$object->getSchemaColumns(),
|
|
|
|
$object->getSchemaKeys());
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function buildRawSchema(
|
|
|
|
$database_name,
|
|
|
|
$table_name,
|
|
|
|
array $columns,
|
|
|
|
array $keys) {
|
|
|
|
$database = $this->getDatabase($database_name);
|
2014-09-18 17:25:34 +02:00
|
|
|
|
2014-09-18 17:36:22 +02:00
|
|
|
$table = $this->newTable($table_name);
|
2014-09-18 17:25:34 +02:00
|
|
|
|
2014-09-18 17:36:22 +02:00
|
|
|
foreach ($columns as $name => $type) {
|
2014-09-18 20:15:49 +02:00
|
|
|
if ($type === null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-09-18 17:32:44 +02:00
|
|
|
$details = $this->getDetailsForDataType($type);
|
2014-10-01 17:24:51 +02:00
|
|
|
list($column_type, $charset, $collation, $nullable, $auto) = $details;
|
2014-09-18 17:25:34 +02:00
|
|
|
|
2014-09-18 17:32:44 +02:00
|
|
|
$column = $this->newColumn($name)
|
|
|
|
->setDataType($type)
|
|
|
|
->setColumnType($column_type)
|
|
|
|
->setCharacterSet($charset)
|
|
|
|
->setCollation($collation)
|
2014-10-01 17:24:51 +02:00
|
|
|
->setNullable($nullable)
|
|
|
|
->setAutoIncrement($auto);
|
2014-09-18 17:25:34 +02:00
|
|
|
|
2014-09-18 17:32:44 +02:00
|
|
|
$table->addColumn($column);
|
2014-09-18 17:25:34 +02:00
|
|
|
}
|
2014-09-18 17:32:44 +02:00
|
|
|
|
|
|
|
foreach ($keys as $key_name => $key_spec) {
|
2014-09-18 20:15:38 +02:00
|
|
|
if ($key_spec === null) {
|
|
|
|
// This is a subclass removing a key which Lisk expects.
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-09-18 17:32:44 +02:00
|
|
|
$key = $this->newKey($key_name)
|
|
|
|
->setColumnNames(idx($key_spec, 'columns', array()));
|
|
|
|
|
2014-09-19 20:46:30 +02:00
|
|
|
$key->setUnique((bool)idx($key_spec, 'unique'));
|
Fix almost all remaining schemata issues
Summary:
Ref T1191. This fixes nearly every remaining blocker for utf8mb4 -- primarily, overlong keys.
Remaining issue is https://secure.phabricator.com/T1191#77467
Test Plan: I'll annotate inline.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley, hach-que
Maniphest Tasks: T6099, T6129, T6133, T6134, T6150, T6148, T6147, T6146, T6105, T1191
Differential Revision: https://secure.phabricator.com/D10601
2014-10-01 17:18:36 +02:00
|
|
|
$key->setIndexType(idx($key_spec, 'type', 'BTREE'));
|
2014-09-19 20:46:30 +02:00
|
|
|
|
2014-09-18 17:32:44 +02:00
|
|
|
$table->addKey($key);
|
|
|
|
}
|
|
|
|
|
|
|
|
$database->addTable($table);
|
2014-09-18 17:25:34 +02:00
|
|
|
}
|
|
|
|
|
2014-09-18 20:15:38 +02:00
|
|
|
protected function buildEdgeSchemata(PhabricatorLiskDAO $object) {
|
|
|
|
$this->buildRawSchema(
|
|
|
|
$object->getApplicationName(),
|
|
|
|
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
|
|
|
array(
|
|
|
|
'src' => 'phid',
|
|
|
|
'type' => 'uint32',
|
|
|
|
'dst' => 'phid',
|
|
|
|
'dateCreated' => 'epoch',
|
|
|
|
'seq' => 'uint32',
|
|
|
|
'dataID' => 'id?',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'PRIMARY' => array(
|
|
|
|
'columns' => array('src', 'type', 'dst'),
|
2014-09-19 20:46:44 +02:00
|
|
|
'unique' => true,
|
|
|
|
),
|
|
|
|
'src' => array(
|
|
|
|
'columns' => array('src', 'type', 'dateCreated', 'seq'),
|
2014-09-18 20:15:38 +02:00
|
|
|
),
|
2014-09-29 00:12:58 +02:00
|
|
|
'key_dst' => array(
|
|
|
|
'columns' => array('dst', 'type', 'src'),
|
|
|
|
'unique' => true,
|
|
|
|
),
|
2014-09-18 20:15:38 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
$this->buildRawSchema(
|
|
|
|
$object->getApplicationName(),
|
|
|
|
PhabricatorEdgeConfig::TABLE_NAME_EDGEDATA,
|
|
|
|
array(
|
2014-10-01 17:24:51 +02:00
|
|
|
'id' => 'auto',
|
2014-09-18 20:15:38 +02:00
|
|
|
'data' => 'text',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'PRIMARY' => array(
|
|
|
|
'columns' => array('id'),
|
2014-09-19 20:46:44 +02:00
|
|
|
'unique' => true,
|
2014-09-18 20:15:38 +02:00
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
2014-09-18 17:25:34 +02:00
|
|
|
|
2014-09-19 14:45:24 +02:00
|
|
|
public function buildCounterSchema(PhabricatorLiskDAO $object) {
|
|
|
|
$this->buildRawSchema(
|
|
|
|
$object->getApplicationName(),
|
|
|
|
PhabricatorLiskDAO::COUNTER_TABLE_NAME,
|
|
|
|
array(
|
|
|
|
'counterName' => 'text32',
|
|
|
|
'counterValue' => 'id64',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'PRIMARY' => array(
|
|
|
|
'columns' => array('counterName'),
|
2014-10-01 16:37:01 +02:00
|
|
|
'unique' => true,
|
2014-09-19 14:45:24 +02:00
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2014-09-18 17:25:34 +02:00
|
|
|
protected function getDatabase($name) {
|
|
|
|
$server = $this->getServer();
|
|
|
|
|
|
|
|
$database = $server->getDatabase($this->getNamespacedDatabase($name));
|
|
|
|
if (!$database) {
|
|
|
|
$database = $this->newDatabase($name);
|
|
|
|
$server->addDatabase($database);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $database;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function newDatabase($name) {
|
|
|
|
return id(new PhabricatorConfigDatabaseSchema())
|
|
|
|
->setName($this->getNamespacedDatabase($name))
|
|
|
|
->setCharacterSet($this->getUTF8Charset())
|
2014-10-01 17:18:53 +02:00
|
|
|
->setCollation($this->getUTF8BinaryCollation());
|
2014-09-18 17:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function getNamespacedDatabase($name) {
|
|
|
|
$namespace = PhabricatorLiskDAO::getStorageNamespace();
|
|
|
|
return $namespace.'_'.$name;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function newTable($name) {
|
|
|
|
return id(new PhabricatorConfigTableSchema())
|
|
|
|
->setName($name)
|
2014-10-01 17:18:53 +02:00
|
|
|
->setCollation($this->getUTF8BinaryCollation());
|
2014-09-18 17:25:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function newColumn($name) {
|
|
|
|
return id(new PhabricatorConfigColumnSchema())
|
|
|
|
->setName($name);
|
|
|
|
}
|
|
|
|
|
2014-09-18 17:32:44 +02:00
|
|
|
protected function newKey($name) {
|
|
|
|
return id(new PhabricatorConfigKeySchema())
|
|
|
|
->setName($name);
|
|
|
|
}
|
|
|
|
|
2014-09-18 17:25:34 +02:00
|
|
|
private function getDetailsForDataType($data_type) {
|
|
|
|
$column_type = null;
|
|
|
|
$charset = null;
|
|
|
|
$collation = null;
|
2014-10-01 17:24:51 +02:00
|
|
|
$auto = false;
|
2014-09-18 17:25:34 +02:00
|
|
|
|
2014-09-18 17:32:44 +02:00
|
|
|
// If the type ends with "?", make the column nullable.
|
|
|
|
$nullable = false;
|
|
|
|
if (preg_match('/\?$/', $data_type)) {
|
|
|
|
$nullable = true;
|
|
|
|
$data_type = substr($data_type, 0, -1);
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:17:45 +02:00
|
|
|
// 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.
|
|
|
|
|
2014-09-18 17:25:34 +02:00
|
|
|
switch ($data_type) {
|
2014-10-01 17:24:51 +02:00
|
|
|
case 'auto':
|
|
|
|
$column_type = 'int(10) unsigned';
|
|
|
|
$auto = true;
|
|
|
|
break;
|
|
|
|
case 'auto64':
|
|
|
|
$column_type = 'bigint(20) unsigned';
|
|
|
|
$auto = true;
|
|
|
|
break;
|
2014-09-18 17:25:34 +02:00
|
|
|
case 'id':
|
|
|
|
case 'epoch':
|
2014-09-18 17:32:44 +02:00
|
|
|
case 'uint32':
|
2014-09-18 17:25:34 +02:00
|
|
|
$column_type = 'int(10) unsigned';
|
|
|
|
break;
|
2014-10-01 16:37:14 +02:00
|
|
|
case 'sint32':
|
|
|
|
$column_type = 'int(10)';
|
|
|
|
break;
|
2014-09-18 17:36:22 +02:00
|
|
|
case 'id64':
|
2014-09-18 20:15:29 +02:00
|
|
|
case 'uint64':
|
2014-09-18 17:36:22 +02:00
|
|
|
$column_type = 'bigint(20) unsigned';
|
|
|
|
break;
|
2014-09-19 20:46:44 +02:00
|
|
|
case 'sint64':
|
|
|
|
$column_type = 'bigint(20)';
|
|
|
|
break;
|
2014-09-18 17:25:34 +02:00
|
|
|
case 'phid':
|
2014-09-18 17:32:44 +02:00
|
|
|
case 'policy';
|
2014-10-01 17:17:45 +02:00
|
|
|
$column_type = 'varbinary(64)';
|
2014-09-18 17:25:34 +02:00
|
|
|
break;
|
Generate expected schemata for User/People tables
Summary:
Ref T1191. Some notes here:
- Drops the old LDAP and OAuth info tables. These were migrated to the ExternalAccount table a very long time ago.
- Separates surplus/missing keys from other types of surplus/missing things. In the long run, my plan is to have only two notice levels:
- Error: something we can't fix (missing database, table, or column; overlong key).
- Warning: something we can fix (surplus anything, missing key, bad column type, bad key columns, bad uniqueness, bad collation or charset).
- For now, retaining three levels is helpful in generating all the expected scheamta.
Test Plan:
- Saw ~200 issues resolve, leaving ~1,300.
- Grepped for removed tables.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T1191
Differential Revision: https://secure.phabricator.com/D10580
2014-10-01 16:36:47 +02:00
|
|
|
case 'bytes64':
|
2014-10-01 17:17:45 +02:00
|
|
|
$column_type = 'binary(64)';
|
Generate expected schemata for User/People tables
Summary:
Ref T1191. Some notes here:
- Drops the old LDAP and OAuth info tables. These were migrated to the ExternalAccount table a very long time ago.
- Separates surplus/missing keys from other types of surplus/missing things. In the long run, my plan is to have only two notice levels:
- Error: something we can't fix (missing database, table, or column; overlong key).
- Warning: something we can fix (surplus anything, missing key, bad column type, bad key columns, bad uniqueness, bad collation or charset).
- For now, retaining three levels is helpful in generating all the expected scheamta.
Test Plan:
- Saw ~200 issues resolve, leaving ~1,300.
- Grepped for removed tables.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T1191
Differential Revision: https://secure.phabricator.com/D10580
2014-10-01 16:36:47 +02:00
|
|
|
break;
|
2014-09-18 20:15:29 +02:00
|
|
|
case 'bytes40':
|
2014-10-01 17:17:45 +02:00
|
|
|
$column_type = 'binary(40)';
|
2014-09-18 20:15:29 +02:00
|
|
|
break;
|
2014-09-29 00:12:21 +02:00
|
|
|
case 'bytes32':
|
2014-10-01 17:17:45 +02:00
|
|
|
$column_type = 'binary(32)';
|
2014-09-29 00:12:21 +02:00
|
|
|
break;
|
2014-09-29 00:12:58 +02:00
|
|
|
case 'bytes20':
|
2014-10-01 17:17:45 +02:00
|
|
|
$column_type = 'binary(20)';
|
2014-09-29 00:12:58 +02:00
|
|
|
break;
|
2014-09-18 17:36:22 +02:00
|
|
|
case 'bytes12':
|
2014-10-01 17:17:45 +02:00
|
|
|
$column_type = 'binary(12)';
|
2014-09-18 17:36:22 +02:00
|
|
|
break;
|
2014-09-29 00:12:58 +02:00
|
|
|
case 'bytes4':
|
2014-10-01 17:17:45 +02:00
|
|
|
$column_type = 'binary(4)';
|
2014-09-18 17:25:34 +02:00
|
|
|
break;
|
2014-09-29 00:12:58 +02:00
|
|
|
case 'bytes':
|
|
|
|
$column_type = 'longblob';
|
|
|
|
break;
|
2014-10-01 17:18:53 +02:00
|
|
|
case 'sort255':
|
|
|
|
$column_type = 'varchar(255)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
|
|
|
$collation = $this->getUTF8SortingCollation();
|
|
|
|
break;
|
|
|
|
case 'sort128':
|
|
|
|
$column_type = 'varchar(128)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
|
|
|
$collation = $this->getUTF8SortingCollation();
|
|
|
|
break;
|
|
|
|
case 'sort64':
|
|
|
|
$column_type = 'varchar(64)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
|
|
|
$collation = $this->getUTF8SortingCollation();
|
|
|
|
break;
|
|
|
|
case 'sort32':
|
|
|
|
$column_type = 'varchar(32)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
|
|
|
$collation = $this->getUTF8SortingCollation();
|
|
|
|
break;
|
|
|
|
case 'sort':
|
|
|
|
$column_type = 'longtext';
|
|
|
|
$charset = $this->getUTF8Charset();
|
|
|
|
$collation = $this->getUTF8SortingCollation();
|
|
|
|
break;
|
2014-09-18 20:15:29 +02:00
|
|
|
case 'text255':
|
|
|
|
$column_type = 'varchar(255)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-18 20:15:29 +02:00
|
|
|
break;
|
Generate expected schemata for User/People tables
Summary:
Ref T1191. Some notes here:
- Drops the old LDAP and OAuth info tables. These were migrated to the ExternalAccount table a very long time ago.
- Separates surplus/missing keys from other types of surplus/missing things. In the long run, my plan is to have only two notice levels:
- Error: something we can't fix (missing database, table, or column; overlong key).
- Warning: something we can fix (surplus anything, missing key, bad column type, bad key columns, bad uniqueness, bad collation or charset).
- For now, retaining three levels is helpful in generating all the expected scheamta.
Test Plan:
- Saw ~200 issues resolve, leaving ~1,300.
- Grepped for removed tables.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T1191
Differential Revision: https://secure.phabricator.com/D10580
2014-10-01 16:36:47 +02:00
|
|
|
case 'text160':
|
|
|
|
$column_type = 'varchar(160)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
Generate expected schemata for User/People tables
Summary:
Ref T1191. Some notes here:
- Drops the old LDAP and OAuth info tables. These were migrated to the ExternalAccount table a very long time ago.
- Separates surplus/missing keys from other types of surplus/missing things. In the long run, my plan is to have only two notice levels:
- Error: something we can't fix (missing database, table, or column; overlong key).
- Warning: something we can fix (surplus anything, missing key, bad column type, bad key columns, bad uniqueness, bad collation or charset).
- For now, retaining three levels is helpful in generating all the expected scheamta.
Test Plan:
- Saw ~200 issues resolve, leaving ~1,300.
- Grepped for removed tables.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T1191
Differential Revision: https://secure.phabricator.com/D10580
2014-10-01 16:36:47 +02:00
|
|
|
break;
|
2014-09-18 17:32:44 +02:00
|
|
|
case 'text128':
|
|
|
|
$column_type = 'varchar(128)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-18 17:32:44 +02:00
|
|
|
break;
|
2014-09-29 00:12:21 +02:00
|
|
|
case 'text80':
|
|
|
|
$column_type = 'varchar(80)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-29 00:12:21 +02:00
|
|
|
break;
|
2014-09-18 17:32:44 +02:00
|
|
|
case 'text64':
|
|
|
|
$column_type = 'varchar(64)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-18 17:32:44 +02:00
|
|
|
break;
|
2014-09-24 22:50:00 +02:00
|
|
|
case 'text40':
|
|
|
|
$column_type = 'varchar(40)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-24 22:50:00 +02:00
|
|
|
break;
|
2014-09-18 17:32:44 +02:00
|
|
|
case 'text32':
|
|
|
|
$column_type = 'varchar(32)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-18 17:32:44 +02:00
|
|
|
break;
|
2014-09-18 20:15:38 +02:00
|
|
|
case 'text20':
|
|
|
|
$column_type = 'varchar(20)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-18 20:15:38 +02:00
|
|
|
break;
|
2014-09-18 17:36:22 +02:00
|
|
|
case 'text16':
|
|
|
|
$column_type = 'varchar(16)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-18 17:36:22 +02:00
|
|
|
break;
|
2014-09-18 17:32:44 +02:00
|
|
|
case 'text12':
|
|
|
|
$column_type = 'varchar(12)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-18 17:32:44 +02:00
|
|
|
break;
|
2014-09-18 20:15:29 +02:00
|
|
|
case 'text8':
|
|
|
|
$column_type = 'varchar(8)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-18 20:15:29 +02:00
|
|
|
break;
|
|
|
|
case 'text4':
|
|
|
|
$column_type = 'varchar(4)';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-18 20:15:29 +02:00
|
|
|
break;
|
2014-09-18 17:25:34 +02:00
|
|
|
case 'text':
|
|
|
|
$column_type = 'longtext';
|
|
|
|
$charset = $this->getUTF8Charset();
|
2014-10-01 17:18:53 +02:00
|
|
|
$collation = $this->getUTF8BinaryCollation();
|
2014-09-18 17:25:34 +02:00
|
|
|
break;
|
2014-09-18 17:32:44 +02:00
|
|
|
case 'bool':
|
|
|
|
$column_type = 'tinyint(1)';
|
|
|
|
break;
|
2014-09-19 14:45:24 +02:00
|
|
|
case 'double':
|
|
|
|
$column_type = 'double';
|
|
|
|
break;
|
2014-09-19 20:46:20 +02:00
|
|
|
case 'date':
|
|
|
|
$column_type = 'date';
|
|
|
|
break;
|
2014-09-18 17:25:34 +02:00
|
|
|
default:
|
|
|
|
$column_type = pht('<unknown>');
|
|
|
|
$charset = pht('<unknown>');
|
|
|
|
$collation = pht('<unknown>');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:24:51 +02:00
|
|
|
return array($column_type, $charset, $collation, $nullable, $auto);
|
2014-09-18 17:25:34 +02:00
|
|
|
}
|
2014-09-18 17:22:54 +02:00
|
|
|
|
|
|
|
}
|