Skip to content

Migrations

This content is for v1.0. Switch to the latest version for up-to-date documentation.

Generate and apply schema changes from Articulate entity metadata.

  • articulate:init creates the migration tracking table.
  • articulate:diff generates migrations from the entity/database schema diff.
  • articulate:migrate runs pending migrations.
config/services.yaml
parameters:
articulate_entities_path: 'src'
articulate_migrations_path: '%env(resolve:ARTICULATE_MIGRATIONS_PATH)%'
articulate_migrations_namespace: 'App\Migrations'

Keep driver-specific migrations in separate folders (e.g. migrations/mysql and migrations/pgsql) and set ARTICULATE_MIGRATIONS_PATH to the active one.

  1. Start services: docker compose up -d.
  2. Run articulate:init.
  3. Run articulate:migrate.

If migrations are already checked in, articulate:diff isn’t required from a clean checkout. Run articulate:diff when you change entity metadata and want Articulate to generate new migration files from the schema difference. From a clean database, the first diff can generate migrations for all mapped entity tables — later diffs should only contain the delta.

Migrations run inside a transaction by default. Override isTransactional() when a migration contains database operations that must run outside a transaction, such as PostgreSQL CREATE INDEX CONCURRENTLY.

protected function isTransactional(): bool
{
return false;
}