Class: MigrateTask
Full name: Azera\Cli\Tasks\MigrateTask
Generate SQL to bring the database schema in line with PHP model definitions.
This is a one-directional tool: PHP → DB. It compares your model classes against the live database and produces the ALTER/CREATE statements needed to make the DB match the models.
No migration tracking table or versioned files — the diff is always computed fresh from the current state.
Usage: migrate:diff Compare all models, output SQL migrate:diff --model=User Compare a single model migrate:diff --apply Execute the SQL directly migrate:diff --file=output.sql Write SQL to a file migrate:diff --dry-run Show SQL without executing (default)
Options:
--model=
Examples: migrate:diff migrate:diff --model=User migrate:diff --model=src/Models/User.php migrate:diff --apply migrate:diff --apply --confirm migrate:diff --file=database/migrations/add_avatar.sql
Public Properties
publicConsole$console·publicarray$options·
Public methods
__construct() ·
public function __construct(): mixed
Return value
- Type:
mixed
diffAction() ·
public function diffAction(): void
Compare PHP model definitions against the database and generate SQL.
Return value
- Type:
void