protected function SchemaMigrator::removeExtraColumns in Schema 8
Parameters
$table TableComparison:
1 call to SchemaMigrator::removeExtraColumns()
- SchemaMigrator::execute in src/
Migration/ SchemaMigrator.php
File
- src/
Migration/ SchemaMigrator.php, line 161 - Contains Drupal\schema\Migration\SchemaMigrator.
Class
- SchemaMigrator
- Modifies the database schema to match the declared schema.
Namespace
Drupal\schema\MigrationCode
protected function removeExtraColumns($table) {
$extra_columns = $table
->getExtraColumns();
if (!empty($extra_columns)) {
/** @var ExtraColumn $column */
foreach ($extra_columns as $column) {
if ($this->dbschema
->dropField($column
->getTableName(), $column
->getColumnName())) {
$this
->logSuccess("Dropped column {table}.{field}.", array(
'table' => $column
->getTableName(),
'field' => $column
->getColumnName(),
));
}
else {
$this
->logError("Tried to drop non-existent field {table}.{field}.", array(
'table' => $column
->getTableName(),
'field' => $column
->getColumnName(),
));
}
}
}
}