public function dropForeignKey( $table, $keyName )
    {
        try
        {
            $tmpTable = $table . '_temp';

            $this->getTableForeignKeys( $table );

            $this->startTransaction();

            $this->copyTable( $table, $tmpTable );

            $this->dropTable( $table );

            $columns = $this->getTableColumns( $tmpTable );

            $this->createTable( $table, $columns );

            $this->copyTableData( $tmpTable, $table, $columns );

            $this->commitTransaction();
        }
        catch ( Exception $e )
        {
            $this->rollbackTransaction();

            return FALSE;
        }

        return TRUE;
    }
public function dropForeignKey( $table, $keyName )
    {
        try
        {
            $tmpTable = $table . '_temp';

            $this->getTableForeignKeys( $table );

            $this->startTransaction();

            $this->copyTable( $table, $tmpTable );

            $this->dropTable( $table );

            $columns = $this->getTableColumns( $tmpTable );

            $this->createTable( $table, $columns );

            $this->copyTableData( $tmpTable, $table, $columns );

            $this->commitTransaction();
        }
        catch ( Exception $e )
        {
            $this->rollbackTransaction();

            return FALSE;
        }

        return TRUE;
    }
public function dropForeignKey ( $ table , $ keyName ) { try { $ tmpTable = $ table . '_temp' ; $ this -> getTableForeignKeys ( $ table ) ; $ this -> startTransaction ( ) ; $ this -> copyTable ( $ table , $ tmpTable ) ; $ this -> dropTable ( $ table ) ; $ columns = $ this -> getTableColumns ( $ tmpTable ) ; $ this -> createTable ( $ table , $ columns ) ; $ this -> copyTableData ( $ tmpTable , $ table , $ columns ) ; $ this -> commitTransaction ( ) ; } catch ( Exception $ e ) { $ this -> rollbackTransaction ( ) ; return FALSE ; } return TRUE ; }
Deletes a foreign key from a table.

@param string $table   table name
@param string $keyName key name

@return bool TRUE on success, FALSE on failure
Deletes a foreign key from a table .