mediatekformation

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

$platform  : AbstractPlatform|null
columnsEqual()  : bool
Compares the definitions of the given columns
compare()  : SchemaDiff
compareSchemas()  : SchemaDiff
Returns a SchemaDiff object containing the differences between the schemas $fromSchema and $toSchema.
diffColumn()  : array<string|int, string>
Returns the difference between the columns
diffForeignKey()  : bool
diffIndex()  : bool
Finds the difference between the indexes $index1 and $index2.
diffSequence()  : bool
diffTable()  : TableDiff|false
Returns the difference between the tables $fromTable and $toTable.
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
normalizeColumns()  : void

Properties

Methods

columnsEqual()

Compares the definitions of the given columns

public columnsEqual(Column $column1, Column $column2) : bool
Parameters
$column1 : Column
$column2 : Column
Tags
throws
Exception
Return values
bool

compareSchemas()

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

public static compareSchemas(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

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
Return values
array<string|int, string>

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

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

normalizeColumns()

private normalizeColumns(Table $table, array<string, mixed> $defaults) : void
Parameters
$table : Table
$defaults : array<string, mixed>
Return values
void

Search results