This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function _update_table_field($fieldName, $valueMapping) { | |
$schema = \Drupal::database()->schema(); | |
$tables = $schema->findTables('%'); | |
foreach ($tables as $table) { | |
if ($schema->fieldExists($table, $fieldName)) { | |
foreach ($valueMapping as $originalValue => $newValue) { | |
echo sprintf( | |
'Updating table %s and field %s from %s to %s', |