Documentation

Comparator
in package

Compares two Schemas and return an instance of SchemaDiff.

Tags
link
www.doctrine-project.org
since
2.0
author

Benjamin Eberlei kontakt@beberlei.de

Table of Contents

compare()  : SchemaDiff
Returns a SchemaDiff object containing the differences between the schemas $fromSchema and $toSchema.
compareSchemas()  : SchemaDiff
diffColumn()  : array<string|int, mixed>
Returns the difference between the fields $field1 and $field2.
diffForeignKey()  : bool
diffIndex()  : bool
Finds the difference between the indexes $index1 and $index2.
diffSequence()  : bool
diffTable()  : bool|TableDiff
Returns the difference between the tables $table1 and $table2.
detectColumnRenamings()  : void
Try to find columns that only changed their name, rename operations maybe cheaper than add/drop however ambiguities between different possibilities should not lead to renaming at all.
detectIndexRenamings()  : void
Try to find indexes that only changed their name, rename operations maybe cheaper than add/drop however ambiguities between different possibilities should not lead to renaming at all.
isAutoIncrementSequenceInSchema()  : bool

Methods

compare()

Returns a SchemaDiff object containing the differences between the schemas $fromSchema and $toSchema.

public compare(Schema $fromSchema, Schema $toSchema) : SchemaDiff

The returned differences are returned in such a way that they contain the operations to change the schema stored in $fromSchema to the schema that is stored in $toSchema.

Parameters
$fromSchema : Schema
$toSchema : Schema
Return values
SchemaDiff

diffColumn()

Returns the difference between the fields $field1 and $field2.

public diffColumn(Column $column1, Column $column2) : array<string|int, mixed>

If there are differences this method returns $field2, otherwise the boolean false.

Parameters
$column1 : Column
$column2 : Column
Return values
array<string|int, mixed>

diffIndex()

Finds the difference between the indexes $index1 and $index2.

public diffIndex(Index $index1, Index $index2) : bool

Compares $index1 with $index2 and returns $index2 if there are any differences or false in case there are no differences.

Parameters
$index1 : Index
$index2 : Index
Return values
bool

diffTable()

Returns the difference between the tables $table1 and $table2.

public diffTable(Table $table1, Table $table2) : bool|TableDiff

If there are no differences this method returns the boolean false.

Parameters
$table1 : Table
$table2 : Table
Return values
bool|TableDiff

detectColumnRenamings()

Try to find columns that only changed their name, rename operations maybe cheaper than add/drop however ambiguities between different possibilities should not lead to renaming at all.

private detectColumnRenamings(TableDiff $tableDifferences) : void
Parameters
$tableDifferences : TableDiff
Return values
void

detectIndexRenamings()

Try to find indexes that only changed their name, rename operations maybe cheaper than add/drop however ambiguities between different possibilities should not lead to renaming at all.

private detectIndexRenamings(TableDiff $tableDifferences) : void
Parameters
$tableDifferences : TableDiff
Return values
void

isAutoIncrementSequenceInSchema()

private isAutoIncrementSequenceInSchema(Schema $schema, Sequence $sequence) : bool
Parameters
$schema : Schema
$sequence : Sequence
Return values
bool

Search results