Schema::processField

protected Schema::processField($field)

Set database-engine specific properties for a field.

Parameters

$field: A field description array, as specified in the schema documentation.

File

core/lib/Drupal/Core/Database/Driver/mysql/Schema.php, line 206

Class

Schema
MySQL implementation of \Drupal\Core\Database\Schema.

Namespace

Drupal\Core\Database\Driver\mysql

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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'] = Unicode::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;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.