Doctrine\DBAL\Platforms\MySqlPlatform::getPreAlterTableAlterPrimaryKeySQL PHP Method

getPreAlterTableAlterPrimaryKeySQL() private method

private getPreAlterTableAlterPrimaryKeySQL ( Doctrine\DBAL\Schema\TableDiff $diff, Doctrine\DBAL\Schema\Index $index ) : string[]
$diff Doctrine\DBAL\Schema\TableDiff
$index Doctrine\DBAL\Schema\Index
return string[]
    private function getPreAlterTableAlterPrimaryKeySQL(TableDiff $diff, Index $index)
    {
        $sql = array();
        if (!$index->isPrimary() || !$diff->fromTable instanceof Table) {
            return $sql;
        }
        $tableName = $diff->getName($this)->getQuotedName($this);
        // Dropping primary keys requires to unset autoincrement attribute on the particular column first.
        foreach ($index->getColumns() as $columnName) {
            $column = $diff->fromTable->getColumn($columnName);
            if ($column->getAutoincrement() === true) {
                $column->setAutoincrement(false);
                $sql[] = 'ALTER TABLE ' . $tableName . ' MODIFY ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
                // original autoincrement information might be needed later on by other parts of the table alteration
                $column->setAutoincrement(true);
            }
        }
        return $sql;
    }
MySqlPlatform