Documentation

Comparator
in package

Compares two Schemas and return an instance of SchemaDiff.

Table of Contents

Properties

$platform  : AbstractPlatform|null

Methods

__call()  : SchemaDiff
__callStatic()  : SchemaDiff
compare()  : SchemaDiff
compareSchemas()  : SchemaDiff
compareTables()  : TableDiff
Compares the tables and returns the difference between them.
diffColumn()  : array<string|int, string>
Returns the difference between the columns
diffSequence()  : bool
diffTable()  : TableDiff|false
Returns the difference between the tables $fromTable and $toTable.
detectRenamedColumns()  : array<string, Column>
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.
detectRenamedIndexes()  : array<string, Index>
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.
doCompareSchemas()  : SchemaDiff
Returns a SchemaDiff object containing the differences between the schemas $fromSchema and $toSchema.
isAutoIncrementSequenceInSchema()  : bool

Properties

Methods

__call()

public __call(string $method, array<int, mixed> $args) : SchemaDiff
Parameters
$method : string
$args : array<int, mixed>
Return values
SchemaDiff

__callStatic()

public static __callStatic(string $method, array<int, mixed> $args) : SchemaDiff
Parameters
$method : string
$args : array<int, mixed>
Return values
SchemaDiff

diffColumn()

Returns the difference between the columns

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

If there are differences this method returns the changed properties as a string array, otherwise an empty array gets returned.

Parameters
$column1 : Column
$column2 : Column
Tags
deprecated

Use columnsEqual() instead.

Return values
array<string|int, string>

diffTable()

Returns the difference between the tables $fromTable and $toTable.

public diffTable(Table $fromTable, Table $toTable) : TableDiff|false

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

Parameters
$fromTable : Table
$toTable : Table
Tags
deprecated

Use compareTables() and, optionally, TableDiff::isEmpty() instead.

throws
Exception
Return values
TableDiff|false

detectRenamedColumns()

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 detectRenamedColumns(array<string, Column&$addedColumns, array<string, Column&$removedColumns) : array<string, Column>
Parameters
$addedColumns : array<string, Column>
$removedColumns : array<string, Column>
Tags
throws
Exception
Return values
array<string, Column>

detectRenamedIndexes()

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 detectRenamedIndexes(array<string, Index&$addedIndexes, array<string, Index&$removedIndexes) : array<string, Index>
Parameters
$addedIndexes : array<string, Index>
$removedIndexes : array<string, Index>
Return values
array<string, Index>

doCompareSchemas()

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

private doCompareSchemas(Schema $fromSchema, Schema $toSchema) : SchemaDiff

This method should be called non-statically since it will be declared as non-static in the next major release.

Parameters
$fromSchema : Schema
$toSchema : Schema
Tags
throws
SchemaException
Return values
SchemaDiff

        
On this page

Search results