protected function _updateConstraints($oldColumnName, $newColumnName)
    {
        $columnIndex = null;
        foreach ($this->_primaryKey as $index => $column) {
            if ($oldColumnName == $column->getName()) {
                $columnIndex = $index;
                break;
            }
        }
        if ($columnIndex !== null) {
            if ($newColumnName) {
                $this->_primaryKey[$columnIndex] = $this->_columns[$newColumnName];
            } else {
                unset($this->_primaryKey[$columnIndex]);
                $this->_primaryKey = array_values($this->_primaryKey);
            }
        }
    }
protected function _updateConstraints($oldColumnName, $newColumnName)
    {
        $columnIndex = null;
        foreach ($this->_primaryKey as $index => $column) {
            if ($oldColumnName == $column->getName()) {
                $columnIndex = $index;
                break;
            }
        }
        if ($columnIndex !== null) {
            if ($newColumnName) {
                $this->_primaryKey[$columnIndex] = $this->_columns[$newColumnName];
            } else {
                unset($this->_primaryKey[$columnIndex]);
                $this->_primaryKey = array_values($this->_primaryKey);
            }
        }
    }
protected function _updateConstraints ( $ oldColumnName , $ newColumnName ) { $ columnIndex = null ; foreach ( $ this -> _primaryKey as $ index => $ column ) { if ( $ oldColumnName == $ column -> getName ( ) ) { $ columnIndex = $ index ; break ; } } if ( $ columnIndex !== null ) { if ( $ newColumnName ) { $ this -> _primaryKey [ $ columnIndex ] = $ this -> _columns [ $ newColumnName ] ; } else { unset ( $ this -> _primaryKey [ $ columnIndex ] ) ; $ this -> _primaryKey = array_values ( $ this -> _primaryKey ) ; } } }
Update constraints after renaming or dropping a column

This updates affected column names in all constraints and must be called
throm the renameColumn() and dropColumn() implementation.

@param string $oldColumnName Column name before renaming/dropping
@param string $newColumnName Column name after renaming, NULL for dropped column
Update constraints after renaming or dropping a column