database-migrations

Create and apply Doctrine schema changes via versioned ORM migrations or mapping-driven ODM sync.

1|Updated Jun 9, 2026
One-click install
npx skills add https://github.com/VilnaCRM-Org/claude-plugins --skill database-migrations-vilnacrm-org
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: database-migrations
Source: https://github.com/VilnaCRM-Org/claude-plugins/tree/main/plugins/php-backend-sdlc/skills/database-migrations
Command: npx skills add https://github.com/VilnaCRM-Org/claude-plugins --skill database-migrations-vilnacrm-org

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing database schema changes in PHP backends is error-prone when entities, XML mappings, repositories, and migrations drift out of sync, especially across both relational (Doctrine ORM) and MongoDB (Doctrine ODM) persistence stacks. ## Core Features & Use Cases - Dual-mapper schema management: Generates versioned migrations with doctrine:migrations:* for doctrine-orm, or syncs collections and indexes with doctrine:mongodb:schema:* for doctrine-odm. - Hexagonal architecture enforcement: Places entities in the Domain layer, repository implementations in Infrastructure, and XML mappings in config/doctrine/, keeping Domain classes framework-agnostic. - Custom identifier types and indexing: Uses ulid and domain_uuid identifier types, defines indexes in XML mappings, and covers MongoDB compound, sparse, TTL, and text indexes. - Use Case: When adding a new Customer entity with an email field, the skill guides creating the Domain class, the .orm.xml or .mongodb.xml mapping, the repository pair, and then applying and validating the schema change with the correct console commands. ## Quick Start Ask the assistant to create a new Customer entity with name and email fields, generate its Doctrine XML mapping and repository, and apply the resulting migration or schema update.

Frequently Asked Questions about database-migrations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Doctrine migration for a new entity in Symfony?▼

Create the entity class in the Domain layer, add an XML mapping in config/doctrine, then run bin/console doctrine:migrations:diff to generate the migration. Review the generated file, apply it with doctrine:migrations:migrate, and verify with doctrine:schema:validate.

How do I sync MongoDB schema with Doctrine ODM?▼

Doctrine ODM has no migration files by default. Define collections and indexes in the .mongodb.xml mapping, then run bin/console doctrine:mongodb:schema:create for new collections or doctrine:mongodb:schema:update to sync indexes and validators after changes.

Should I use Doctrine ORM migrations or ODM schema sync?▼

It depends on the persistence.mapper profile value. Use doctrine-orm with versioned migrations for MySQL, MariaDB, or PostgreSQL; use doctrine-odm with mapping-driven schema commands for MongoDB, where only data backfills and renames need explicit scripts.

Why does doctrine:mongodb:schema:update fail with an index conflict?▼

An existing index with the same name but different options blocks the update. Drop the old index in mongosh with db.<collection>.dropIndex("<name>"), then re-run the schema update command.

Can I use Doctrine annotations or attributes in Domain entity classes?▼

No. All metadata must live in XML mappings under config/doctrine so Domain classes stay framework-agnostic. Annotations or attributes in Domain classes violate the hexagonal architecture rules and deptrac layer constraints.

What should I do with an empty generated Doctrine migration?▼

Delete it immediately. Empty migration files with no-op up() and down() bodies should never be committed, and a migration that has been applied anywhere must never be modified afterward.