class Comparator (View source)

Compares two Schemas and return an instance of SchemaDiff.

Methods

static SchemaDiff
compareSchemas(Schema $fromSchema, Schema $toSchema)

No description

compare(Schema $fromSchema, Schema $toSchema)

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

bool
diffSequence(Sequence $sequence1, Sequence $sequence2)

No description

TableDiff|false
diffTable(Table $table1, Table $table2)

Returns the difference between the tables $table1 and $table2.

bool
array
diffColumn(Column $column1, Column $column2)

Returns the difference between the fields $field1 and $field2.

bool
diffIndex(Index $index1, Index $index2)

Finds the difference between the indexes $index1 and $index2.

Details

static SchemaDiff compareSchemas(Schema $fromSchema, Schema $toSchema)

Parameters

Schema $fromSchema
Schema $toSchema

Return Value

SchemaDiff

SchemaDiff compare(Schema $fromSchema, Schema $toSchema)

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

The returned differences are returned in such a way that they contain the operations to change the schema stored in $fromSchema to the schema that is stored in $toSchema.

Parameters

Schema $fromSchema
Schema $toSchema

Return Value

SchemaDiff

bool diffSequence(Sequence $sequence1, Sequence $sequence2)

Parameters

Sequence $sequence1
Sequence $sequence2

Return Value

bool

TableDiff|false diffTable(Table $table1, Table $table2)

Returns the difference between the tables $table1 and $table2.

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

Parameters

Table $table1
Table $table2

Return Value

TableDiff|false

bool diffForeignKey(ForeignKeyConstraint $key1, ForeignKeyConstraint $key2)

Parameters

ForeignKeyConstraint $key1
ForeignKeyConstraint $key2

Return Value

bool

array diffColumn(Column $column1, Column $column2)

Returns the difference between the fields $field1 and $field2.

If there are differences this method returns $field2, otherwise the boolean false.

Parameters

Column $column1
Column $column2

Return Value

array

bool diffIndex(Index $index1, Index $index2)

Finds the difference between the indexes $index1 and $index2.

Compares $index1 with $index2 and returns $index2 if there are any differences or false in case there are no differences.

Parameters

Index $index1
Index $index2

Return Value

bool