Comparator extends Comparator
Compares two Schemas and returns an instance of SchemaDiff.
Table of Contents
Properties
- $databasePlatform : AbstractPlatform|null
Methods
- __construct() : mixed
- Comparator constructor.
- columnsEqual() : bool
- compareSchemas() : SchemaDiff
- Returns a SchemaDiff object containing the differences between the schemas $fromSchema and $toSchema.
- diffColumn() : array<string|int, mixed>
- Returns the difference between the columns $column1 and $column2 by first checking the doctrine diffColumn. Extend the Doctrine method by taking into account MySQL TINY/MEDIUM/LONG type variants.
- diffTable() : false|TableDiff|TableDiff
- Returns the difference between the tables $fromTable and $toTable.
Properties
$databasePlatform
protected
AbstractPlatform|null
$databasePlatform
Methods
__construct()
Comparator constructor.
public
__construct([AbstractPlatform|null $platform = null ]) : mixed
Parameters
- $platform : AbstractPlatform|null = null
columnsEqual()
public
columnsEqual(Column $column1, Column $column2) : bool
Parameters
- $column1 : Column
- $column2 : Column
Tags
Return values
boolcompareSchemas()
Returns a SchemaDiff object containing the differences between the schemas $fromSchema and $toSchema.
public
static compareSchemas(Schema $fromSchema, Schema $toSchema[, AbstractPlatform|null $platform = null ]) : SchemaDiff
This method should be called non-statically since it will be declared as non-static in the next doctrine/dbal major release.
doctrine/dbal uses new self() in this method, which instantiate the doctrine
Comparator class and not our extended class, thus not calling our overridden
methods 'diffTable()' and 'diffColum()' and breaking core table engine support,
which is tested in core functional tests explicity. See corresponding test
TYPO3\CMS\Core\Tests\Functional\Database\Schema\SchemaMigratorTest->changeTableEngine()
Parameters
- $fromSchema : Schema
- $toSchema : Schema
- $platform : AbstractPlatform|null = null
Tags
Return values
SchemaDiffdiffColumn()
Returns the difference between the columns $column1 and $column2 by first checking the doctrine diffColumn. Extend the Doctrine method by taking into account MySQL TINY/MEDIUM/LONG type variants.
public
diffColumn(Column $column1, Column $column2) : array<string|int, mixed>
Parameters
- $column1 : Column
- $column2 : Column
Return values
array<string|int, mixed>diffTable()
Returns the difference between the tables $fromTable and $toTable.
public
diffTable(Table $fromTable, Table $toTable) : false|TableDiff|TableDiff
If there are no differences this method returns the boolean false.
Parameters
- $fromTable : Table
- $toTable : Table