Comparator
extends Comparator
in package
Compares schemas in the context of SQLite platform.
BINARY is the default column collation and should be ignored if specified explicitly.
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
$platform
private
AbstractPlatform|null
$platform
Methods
columnsEqual()
Compares the definitions of the given columns
public
columnsEqual(Column $column1, Column $column2) : bool
Parameters
Tags
Return values
bool —compare()
public
compare(Schema $fromSchema, Schema $toSchema) : SchemaDiff
Parameters
Tags
Return values
SchemaDiff —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
Tags
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
Return values
array<string|int, string> —diffForeignKey()
public
diffForeignKey(ForeignKeyConstraint $key1, ForeignKeyConstraint $key2) : bool
Parameters
- $key1 : ForeignKeyConstraint
- $key2 : ForeignKeyConstraint
Return values
bool —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
Return values
bool —diffSequence()
public
diffSequence(Sequence $sequence1, Sequence $sequence2) : bool
Parameters
Return values
bool —diffTable()
Returns the difference between the tables $fromTable and $toTable.
public
diffTable(Table $fromTable, Table $toTable) : TableDiff|false
Parameters
Return values
TableDiff|false —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
Return values
bool —normalizeColumns()
private
normalizeColumns(Table $table) : void
Parameters
- $table : Table