void renameColumn(String tableName, String columnName, String newName)

Validates and renames a column in a table in schema.

Source

void renameColumn(String tableName, String columnName, String newName) {
  var table = schema.tableForName(tableName);
  if (table == null) {
    throw new SchemaException("Table $tableName does not exist.");
  }

  var column = table.columnForName(columnName);
  if (column == null) {
    throw new SchemaException("Column $columnName does not exists.");
  }

  table.renameColumn(column, newName);

  if (store != null) {
    commands.addAll(store.renameColumn(table, column, newName));
  }
}