Quick Start¶
Initialize the project files:
vendor/bin/schemage --init
Create or edit database/schema.php:
<?php
use Schemage\DSL\Schema;
use Schemage\DSL\Table;
return function (Schema $schema): void {
$schema->table('users', function (Table $t): void {
$t->id();
$t->string('name');
$t->string('email')->unique('users_email_unique');
$t->timestamps();
});
};
Preview changes:
vendor/bin/schemage --dry-run
Apply interactively:
vendor/bin/schemage
Apply a safe migration without confirmation:
vendor/bin/schemage --yes
Apply a destructive migration without confirmation:
vendor/bin/schemage --yes --force
After a successful migration, run the dry-run again. The expected result is:
Database is up to date.