public function getModifyTableDDL(PropelTableDiff $tableDiff)
    {
        $ret = '';

        // drop indices, foreign keys
        if ($tableDiff->hasModifiedPk()) {
            $ret .= $this->getDropPrimaryKeyDDL($tableDiff->getFromTable());
        }
        foreach ($tableDiff->getRemovedFks() as $fk) {
            $ret .= $this->getDropForeignKeyDDL($fk);
        }
        foreach ($tableDiff->getModifiedFks() as $fkName => $fkModification) {
            list($fromFk, $toFk) = $fkModification;
            $ret .= $this->getDropForeignKeyDDL($fromFk);
        }
        foreach ($tableDiff->getRemovedIndices() as $index) {
            $ret .= $this->getDropIndexDDL($index);
        }
        foreach ($tableDiff->getModifiedIndices() as $indexName => $indexModification) {
            list($fromIndex, $toIndex) = $indexModification;
            $ret .= $this->getDropIndexDDL($fromIndex);
        }

        // alter table structure
        foreach ($tableDiff->getRenamedColumns() as $columnRenaming) {
            $ret .= $this->getRenameColumnDDL($columnRenaming[0], $columnRenaming[1]);
        }
        if ($modifiedColumns = $tableDiff->getModifiedColumns()) {
            $ret .= $this->getModifyColumnsDDL($modifiedColumns);
        }
        if ($addedColumns = $tableDiff->getAddedColumns()) {
            $ret .= $this->getAddColumnsDDL($addedColumns);
        }
        foreach ($tableDiff->getRemovedColumns() as $column) {
            $ret .= $this->getRemoveColumnDDL($column);
        }

        // add new indices and foreign keys
        if ($tableDiff->hasModifiedPk()) {
            $ret .= $this->getAddPrimaryKeyDDL($tableDiff->getToTable());
        }
        foreach ($tableDiff->getModifiedIndices() as $indexName => $indexModification) {
            list($fromIndex, $toIndex) = $indexModification;
            $ret .= $this->getAddIndexDDL($toIndex);
        }
        foreach ($tableDiff->getAddedIndices() as $index) {
            $ret .= $this->getAddIndexDDL($index);
        }
        foreach ($tableDiff->getModifiedFks() as $fkName => $fkModification) {
            list($fromFk, $toFk) = $fkModification;
            $ret .= $this->getAddForeignKeyDDL($toFk);
        }
        foreach ($tableDiff->getAddedFks() as $fk) {
            $ret .= $this->getAddForeignKeyDDL($fk);
        }

        return $ret;
    }
public function getModifyTableDDL(PropelTableDiff $tableDiff)
    {
        $ret = '';

        // drop indices, foreign keys
        if ($tableDiff->hasModifiedPk()) {
            $ret .= $this->getDropPrimaryKeyDDL($tableDiff->getFromTable());
        }
        foreach ($tableDiff->getRemovedFks() as $fk) {
            $ret .= $this->getDropForeignKeyDDL($fk);
        }
        foreach ($tableDiff->getModifiedFks() as $fkName => $fkModification) {
            list($fromFk, $toFk) = $fkModification;
            $ret .= $this->getDropForeignKeyDDL($fromFk);
        }
        foreach ($tableDiff->getRemovedIndices() as $index) {
            $ret .= $this->getDropIndexDDL($index);
        }
        foreach ($tableDiff->getModifiedIndices() as $indexName => $indexModification) {
            list($fromIndex, $toIndex) = $indexModification;
            $ret .= $this->getDropIndexDDL($fromIndex);
        }

        // alter table structure
        foreach ($tableDiff->getRenamedColumns() as $columnRenaming) {
            $ret .= $this->getRenameColumnDDL($columnRenaming[0], $columnRenaming[1]);
        }
        if ($modifiedColumns = $tableDiff->getModifiedColumns()) {
            $ret .= $this->getModifyColumnsDDL($modifiedColumns);
        }
        if ($addedColumns = $tableDiff->getAddedColumns()) {
            $ret .= $this->getAddColumnsDDL($addedColumns);
        }
        foreach ($tableDiff->getRemovedColumns() as $column) {
            $ret .= $this->getRemoveColumnDDL($column);
        }

        // add new indices and foreign keys
        if ($tableDiff->hasModifiedPk()) {
            $ret .= $this->getAddPrimaryKeyDDL($tableDiff->getToTable());
        }
        foreach ($tableDiff->getModifiedIndices() as $indexName => $indexModification) {
            list($fromIndex, $toIndex) = $indexModification;
            $ret .= $this->getAddIndexDDL($toIndex);
        }
        foreach ($tableDiff->getAddedIndices() as $index) {
            $ret .= $this->getAddIndexDDL($index);
        }
        foreach ($tableDiff->getModifiedFks() as $fkName => $fkModification) {
            list($fromFk, $toFk) = $fkModification;
            $ret .= $this->getAddForeignKeyDDL($toFk);
        }
        foreach ($tableDiff->getAddedFks() as $fk) {
            $ret .= $this->getAddForeignKeyDDL($fk);
        }

        return $ret;
    }
public function getModifyTableDDL ( PropelTableDiff $ tableDiff ) { $ ret = '' ; // drop indices, foreign keys if ( $ tableDiff -> hasModifiedPk ( ) ) { $ ret .= $ this -> getDropPrimaryKeyDDL ( $ tableDiff -> getFromTable ( ) ) ; } foreach ( $ tableDiff -> getRemovedFks ( ) as $ fk ) { $ ret .= $ this -> getDropForeignKeyDDL ( $ fk ) ; } foreach ( $ tableDiff -> getModifiedFks ( ) as $ fkName => $ fkModification ) { list ( $ fromFk , $ toFk ) = $ fkModification ; $ ret .= $ this -> getDropForeignKeyDDL ( $ fromFk ) ; } foreach ( $ tableDiff -> getRemovedIndices ( ) as $ index ) { $ ret .= $ this -> getDropIndexDDL ( $ index ) ; } foreach ( $ tableDiff -> getModifiedIndices ( ) as $ indexName => $ indexModification ) { list ( $ fromIndex , $ toIndex ) = $ indexModification ; $ ret .= $ this -> getDropIndexDDL ( $ fromIndex ) ; } // alter table structure foreach ( $ tableDiff -> getRenamedColumns ( ) as $ columnRenaming ) { $ ret .= $ this -> getRenameColumnDDL ( $ columnRenaming [ 0 ] , $ columnRenaming [ 1 ] ) ; } if ( $ modifiedColumns = $ tableDiff -> getModifiedColumns ( ) ) { $ ret .= $ this -> getModifyColumnsDDL ( $ modifiedColumns ) ; } if ( $ addedColumns = $ tableDiff -> getAddedColumns ( ) ) { $ ret .= $ this -> getAddColumnsDDL ( $ addedColumns ) ; } foreach ( $ tableDiff -> getRemovedColumns ( ) as $ column ) { $ ret .= $ this -> getRemoveColumnDDL ( $ column ) ; } // add new indices and foreign keys if ( $ tableDiff -> hasModifiedPk ( ) ) { $ ret .= $ this -> getAddPrimaryKeyDDL ( $ tableDiff -> getToTable ( ) ) ; } foreach ( $ tableDiff -> getModifiedIndices ( ) as $ indexName => $ indexModification ) { list ( $ fromIndex , $ toIndex ) = $ indexModification ; $ ret .= $ this -> getAddIndexDDL ( $ toIndex ) ; } foreach ( $ tableDiff -> getAddedIndices ( ) as $ index ) { $ ret .= $ this -> getAddIndexDDL ( $ index ) ; } foreach ( $ tableDiff -> getModifiedFks ( ) as $ fkName => $ fkModification ) { list ( $ fromFk , $ toFk ) = $ fkModification ; $ ret .= $ this -> getAddForeignKeyDDL ( $ toFk ) ; } foreach ( $ tableDiff -> getAddedFks ( ) as $ fk ) { $ ret .= $ this -> getAddForeignKeyDDL ( $ fk ) ; } return $ ret ; }
Builds the DDL SQL to alter a table
based on a PropelTableDiff instance

@return string
Builds the DDL SQL to alter a table based on a PropelTableDiff instance