Comparator
extends Comparator
in package
Compares schemas in the context of MySQL platform.
In MySQL, unless specified explicitly, the column's character set and collation are inherited from its containing table. So during comparison, an omitted value and the value that matches the default value of table in the desired schema must be considered equal.
Table of Contents
Properties
- $collationMetadataProvider : CollationMetadataProvider
- $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
- normalizeColumns() : Table
- normalizeOptions() : array<string, string>
Properties
$collationMetadataProvider
private
CollationMetadataProvider
$collationMetadataProvider
$platform
private
AbstractPlatform|null
$platform
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
SchemaDiffcompare()
public
compare(Schema $fromSchema, Schema $toSchema) : SchemaDiff
Parameters
Tags
Return values
SchemaDiffcompareSchemas()
public
compareSchemas(Schema $fromSchema, Schema $toSchema) : SchemaDiff
Parameters
Return values
SchemaDiffcompareTables()
Compares the tables and returns the difference between them.
public
compareTables(Table $fromTable, Table $toTable) : TableDiff
Parameters
Return values
TableDiffdiffColumn()
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
Tags
Return values
array<string|int, string>diffSequence()
public
diffSequence(Sequence $sequence1, Sequence $sequence2) : bool
Parameters
Return values
booldiffTable()
Returns the difference between the tables $fromTable and $toTable.
public
diffTable(Table $fromTable, Table $toTable) : TableDiff|false
Parameters
Return values
TableDiff|falsedetectRenamedColumns()
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
Tags
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
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
Tags
Return values
SchemaDiffisAutoIncrementSequenceInSchema()
private
isAutoIncrementSequenceInSchema(Schema $schema, Sequence $sequence) : bool
Parameters
Return values
boolnormalizeColumns()
private
normalizeColumns(Table $table) : Table
Parameters
- $table : Table
Return values
TablenormalizeOptions()
private
normalizeOptions(array<string, string> $options) : array<string, string>
Parameters
- $options : array<string, string>