
Symfony:doctrine Migrations Skill
- 519 installs
- 190 repo stars
- Updated August 6, 2026
- makfly/superpowers-symfony
symfony:doctrine-migrations is an agent skill that generates, runs, and manages Doctrine database migrations inside Symfony projects for developers who need safe schema evolution without manual SQL drift.
About
symfony:doctrine-migrations is a Symfony-focused agent skill from makfly/superpowers-symfony that guides AI agents through Doctrine migration workflows—creating migration classes, diffing entity changes, running `doctrine:migrations:migrate`, and rolling back when needed. Ranked 4 in its parent bundle with 420 installs on Skills.sh, it encodes Symfony Console commands, `migrations.yaml` configuration, and entity-to-schema conventions so agents do not hand-write brittle SQL. Developers reach for symfony:doctrine-migrations when adding columns, renaming tables, seeding reference data, or reconciling local and staging databases in PHP Symfony apps using Doctrine ORM.
- Automates Doctrine migration creation from entity changes
- Runs migrations with safety checks and rollback options
- Integrates directly with Symfony console commands via agent
- Handles schema updates, fixtures, and version control for databases
- Part of the Makfly Superpowers Symfony skill collection
Symfony:Doctrine Migrations by the numbers
- 519 all-time installs (skills.sh)
- Ranked #813 of 4,492 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 11, 2026 (Skillselion catalog sync)
npx skills add https://github.com/makfly/superpowers-symfony --skill symfonydoctrine-migrationsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 519 |
|---|---|
| repo stars | ★ 190 |
| Last updated | August 6, 2026 |
| Repository | makfly/superpowers-symfony ↗ |
How do you manage Doctrine migrations in Symfony?
Generate, run, and manage Doctrine database migrations inside Symfony projects using an AI agent.
Who is it for?
Symfony developers using Doctrine ORM who want an agent to handle migration generation, execution, and rollback with correct Console commands.
Skip if: Teams on Laravel, Eloquent, or raw SQL migration tools without Symfony and Doctrine ORM in the stack.
When should I use this skill?
A Symfony project needs a new database migration generated, applied, rolled back, or debugged after entity or mapping changes.
What you get
Versioned migration PHP classes, updated `doctrine_migration_versions` table, and a migrated database schema aligned with Symfony entities.
- Doctrine migration PHP classes
- Applied database schema
By the numbers
- 420 installs on Skills.sh
- Ranked 4 in makfly/superpowers-symfony bundle
Files
Doctrine Migrations (Symfony)
Use when
- Designing entity relations or schema evolution.
- Improving Doctrine correctness/performance.
Default workflow
1. Model ownership/cardinality and transactional boundaries. 2. Apply mapping/schema changes with migration safety. 3. Tune fetch/query behavior for hot paths. 4. Verify lifecycle behavior with targeted tests.
Guardrails
- Keep owning/inverse sides coherent.
- Avoid destructive migration jumps in one release.
- Eliminate accidental N+1 and over-fetching.
Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.
Output contract
- Entity/migration changes.
- Integrity and performance decisions.
- Validation outcomes and rollback notes.
References
reference.mddocs/complexity-tiers.md
Doctrine Migrations Reference (Symfony)
Use this reference for implementation details and review criteria specific to doctrine-migrations.
Versions (target): DoctrineMigrationsBundle `^3.0`, which wraps the `doctrine/migrations` library 4.0.x (5.0 in development). Migration classes use the typed, void-returning signatures up(Schema $schema): void / down(Schema $schema): void.
Install
composer require doctrine/doctrine-migrations-bundle "^3.0"Typical workflow
# 1. Change your entity mapping (#[ORM\...]), then generate the diff
php bin/console make:migration # MakerBundle wrapper around diff
# or:
php bin/console doctrine:migrations:diff
# 2. Review the generated up()/down() SQL (NEVER trust the diff blindly)
# 3. Apply
php bin/console doctrine:migrations:migrate
# Useful neighbours
php bin/console doctrine:migrations:status
php bin/console doctrine:migrations:migrate prev # roll back one version
php bin/console doctrine:migrations:execute 'DoctrineMigrations\Version20260617120000' --downMigration class
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260617120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add status column to product';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE product ADD status VARCHAR(20) NOT NULL DEFAULT \'draft\'');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE product DROP status');
}
}down() must reverse up(). A migration without a real down() cannot be rolled back safely — write it even when it feels redundant.
Configuration (config/packages/doctrine_migrations.yaml)
doctrine_migrations:
migrations_paths:
'DoctrineMigrations': '%kernel.project_dir%/migrations'
enable_profiler: false
# Wrap EACH migration in its own transaction (default true).
transactional: true
# Run ALL pending migrations inside ONE transaction (default false).
# On MySQL most DDL is non-transactional (implicit commit), so this is
# mainly effective on PostgreSQL.
all_or_nothing: false
check_database_platform: true
organize_migrations: false # or BY_YEAR / BY_YEAR_AND_MONTHKey options:
| Option | Default | Purpose |
|---|---|---|
migrations_paths | — | namespace → path pairs (required) |
transactional | true | wrap each migration in a transaction |
all_or_nothing | false | run all pending migrations in one transaction |
em | default | entity manager (overrides connection) |
check_database_platform | true | verify the DB type matches |
enable_service_migrations | false | allow migrations to be fetched from the container (DI) |
Multiple entity managers
Each EM has its own migration history. Pass --em to every command:
php bin/console doctrine:migrations:diff --em=customer
php bin/console doctrine:migrations:migrate --em=customerWhen you have a non-default EM, also set em: (or a dedicated path) in doctrine_migrations.yaml, and in prod redefine the default EM in config/packages/prod/doctrine.yaml.
Best practices
1. Review the diff before applying. diff reflects mapping vs current DB; it can emit destructive or surprising DDL (renames seen as drop+add, index churn). Read every addSql() line. 2. Schema only — no data migrations in schema migrations. Mixing data changes into a diff-generated migration breaks reversibility and gets clobbered on the next diff. For data, use a dedicated, hand-written migration or a one-off command, and keep it idempotent. 3. Always write `down()` so the change is reversible. 4. One concern per migration. Easier to review, revert, and reason about. 5. Never edit an already-applied migration. Add a new one instead. 6. Service migrations (enable_service_migrations: true) when a migration genuinely needs a service — tag it doctrine_migrations.migration and call parent::__construct($connection, $logger).
Applicability
- Target: bundle
^3.0+ library 4.0.x, typedup/down(Schema): void. - The signatures and
transactional/all_or_nothingoptions shown apply to
library 3.x and 4.x alike.
Skill Operating Checklist
Design checklist
- Confirm operation boundaries and invariants first.
- Minimize scope while preserving contract correctness.
- Test both happy path and negative path behavior.
Validation commands
- php bin/console doctrine:migrations:diff
- php bin/console doctrine:migrations:migrate
- ./vendor/bin/phpunit --filter=Doctrine
Failure modes to test
- Invalid payload or forbidden actor.
- Boundary values / not-found cases.
- Retry or partial-failure behavior for async flows.
Related skills
How it compares
Pick symfony:doctrine-migrations over generic SQL migration skills when the stack is Symfony with Doctrine ORM and Console-driven migration workflows.
FAQ
What Symfony commands does symfony:doctrine-migrations cover?
symfony:doctrine-migrations guides Doctrine migration workflows through Symfony Console, including `doctrine:migrations:diff` to generate migration classes from entity changes and `doctrine:migrations:migrate` to apply pending versions safely.
When should I use symfony:doctrine-migrations?
symfony:doctrine-migrations fits Symfony projects using Doctrine ORM when entity or mapping changes require versioned schema updates, rollbacks, or reconciliation between local and deployed databases.