You are here

protected function SchemaMigrator::updateColumnProperties in Schema 8

Parameters

$table TableComparison:

1 call to SchemaMigrator::updateColumnProperties()
SchemaMigrator::execute in src/Migration/SchemaMigrator.php

File

src/Migration/SchemaMigrator.php, line 133
Contains Drupal\schema\Migration\SchemaMigrator.

Class

SchemaMigrator
Modifies the database schema to match the declared schema.

Namespace

Drupal\schema\Migration

Code

protected function updateColumnProperties($table) {
  $differences = $table
    ->getDifferentColumns();
  if (!empty($differences)) {

    /** @var DifferentColumn $column */
    foreach ($differences as $column) {

      // The schema comparator has already determined that the field exists
      // and that at least some of the properties are different.+
      // @todo Update respective indices at the same time; otherwise this will fail for primary keys.
      $this->dbschema
        ->changeField($column
        ->getTableName(), $column
        ->getColumnName(), $column
        ->getColumnName(), $column
        ->getDeclaredSchema());
      $this
        ->logSuccess("Changed column {table}.{field} definition to {schema}.", array(
        'table' => $column
          ->getTableName(),
        'field' => $column
          ->getColumnName(),
        'schema' => '[' . $this
          ->schemaString($column
          ->getDeclaredSchema()) . ']',
      ));
    }
  }
}