Documentation

No matching pages.

API

Config

Facade

Lifecycle

Class: SchemaDiff

Full name: Azera\Sync\SchemaDiff

Compares a PHP model definition against a database table schema and produces SqlOperation objects that would bring the DB in line with the model (PHP → DB direction).

This is the inverse of ModelDiff, which goes DB → PHP.

The diff is purely informational by default. Operations can be converted to SQL via SqlGenerator and optionally executed.

Public methods

diff() ·

public function diff(Azera\Sync\ParsedModel $model, Azera\Sync\Schema\TableSchema $table): array

Parameters

Name Type Default Description
$model ParsedModel -
$table TableSchema -

Return value

  • Type: array

diffTableExists() ·

public function diffTableExists(Azera\Sync\ParsedModel $model, Azera\Sync\Schema\TableSchema|null $table): array

Check if a table exists at all based on the diff.

If the model has no matching table, a CreateTable operation is needed.

Parameters

Name Type Default Description
$model ParsedModel -
$table TableSchema|null -

Return value

  • Type: array

Back to the Index