protected function Schema::processField in Drupal 10
Same name in this branch
- 10 core/modules/sqlite/src/Driver/Database/sqlite/Schema.php \Drupal\sqlite\Driver\Database\sqlite\Schema::processField()
- 10 core/modules/pgsql/src/Driver/Database/pgsql/Schema.php \Drupal\pgsql\Driver\Database\pgsql\Schema::processField()
- 10 core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::processField()
Set database-engine specific properties for a field.
Parameters
$field: A field description array, as specified in the schema documentation.
4 calls to Schema::processField()
- Schema::addField in core/
modules/ mysql/ src/ Driver/ Database/ mysql/ Schema.php - Add a new field to a table.
- Schema::changeField in core/
modules/ mysql/ src/ Driver/ Database/ mysql/ Schema.php - Change a field definition.
- Schema::createTableSql in core/
modules/ mysql/ src/ Driver/ Database/ mysql/ Schema.php - Generate SQL to create a new table from a Drupal schema definition.
- Schema::getNormalizedIndexes in core/
modules/ mysql/ src/ Driver/ Database/ mysql/ Schema.php - Gets normalized indexes from a table specification.
File
- core/
modules/ mysql/ src/ Driver/ Database/ mysql/ Schema.php, line 210
Class
- Schema
- MySQL implementation of \Drupal\Core\Database\Schema.
Namespace
Drupal\mysql\Driver\Database\mysqlCode
protected function processField($field) {
if (!isset($field['size'])) {
$field['size'] = 'normal';
}
// Set the correct database-engine specific datatype.
// In case one is already provided, force it to uppercase.
if (isset($field['mysql_type'])) {
$field['mysql_type'] = mb_strtoupper($field['mysql_type']);
}
else {
$map = $this
->getFieldTypeMap();
$field['mysql_type'] = $map[$field['type'] . ':' . $field['size']];
}
if (isset($field['type']) && $field['type'] == 'serial') {
$field['auto_increment'] = TRUE;
}
return $field;
}