Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Doctrine Migrations Bundle

Doctrine Migrations Bundle Laravel Package

doctrine/doctrine-migrations-bundle

Integrates Doctrine Migrations into Symfony apps, providing commands and configuration for versioned database schema changes. Generate, run, and rollback migrations across environments with reliable tracking and deployment-friendly workflows.

View on GitHub
Deep Wiki
Context7

doctrine/doctrine-migrations-bundle integrates Doctrine Migrations into Symfony, providing a clean workflow to version, run, and track database schema changes alongside your application code. It wires migrations into the framework with sensible defaults, configuration, and console tooling, making upgrades predictable across environments.

Use it to generate migration classes, execute them safely, and keep a consistent migration history in your database—whether you’re evolving an existing schema or shipping incremental changes in CI/CD.

  • Symfony console commands to generate, diff, and run migrations
  • Versioned migration tracking stored in a dedicated migrations table
  • Configurable paths & namespaces for organizing migration classes
  • Transactional/atomic execution options (DB-dependent) and rollbacks
  • Plays well with Doctrine ORM/DBAL and environment-based configuration
Frequently asked questions about Doctrine Migrations Bundle
Can I use doctrine/doctrine-migrations-bundle in a Laravel app without Symfony?
Yes, but with effort. The bundle is Symfony-focused, so you’ll need to manually integrate Symfony’s Console component or use Laravel’s Artisan as a facade. If your app already uses Doctrine ORM (e.g., via `laravel-doctrine/orm`), integration is smoother. For pure Laravel, consider standalone `doctrine/doctrine-migrations` instead.
How do I install this bundle in Laravel?
Run `composer require doctrine/doctrine-migrations-bundle`. If using Doctrine ORM, configure it in `config/packages/doctrine.yaml`. For Laravel, extend your `Kernel.php` to register Symfony commands or create Artisan facades. Ensure `doctrine/orm` or `doctrine/dbal` is installed first.
Will this bundle replace Laravel’s native migrations?
Yes, but conflicts may arise. This bundle uses its own `migration_versions` table, while Laravel uses `migrations`. Decide upfront whether to migrate all existing Laravel migrations to Doctrine format or run them side-by-side (not recommended). Test thoroughly in staging first.
Does this support multi-database setups (e.g., PostgreSQL + MySQL) in Laravel?
Absolutely. The bundle works with multiple Doctrine connections, making it ideal for polyglot persistence. Configure each connection in `config/packages/doctrine.yaml` and target them via `--connection` flags in commands like `doctrine:migrations:execute`. Validate connection configs early in CI.
How do I generate a migration for an existing Doctrine entity?
Run `php bin/console make:migration` (or your Artisan facade) and specify the entity class. The bundle generates a PHP migration class with SQL for creating/updating tables based on your entity’s annotations/metadata. For complex schemas, use `doctrine:migrations:diff` to auto-generate changes.
Are migrations atomic/transactional in this bundle?
Yes, by default. The bundle wraps migrations in transactions where supported (e.g., PostgreSQL, MySQL). For databases without transactional DDL (e.g., SQLite), migrations run non-atomically. Use `--dry-run` to test safety before execution. Rollbacks are supported but may require manual SQL for complex schemas.
What Laravel versions and PHP versions does this bundle support?
The bundle itself requires **Symfony 6.4+**, but Laravel integration depends on your setup. For PHP, **8.2+** is fully supported (bundle v4.0.0+). PHP 8.1 may need patch versions (e.g., v3.x). PHP 7.x is unsupported. If using `laravel-doctrine/orm`, check its Laravel version compatibility (e.g., Laravel 10+).
How do I test migrations in CI/CD for Laravel?
Use database snapshots or transactions to isolate tests. Run `doctrine:migrations:execute --dry-run` first to validate SQL. For rollback testing, use `doctrine:migrations:rollback` and verify schema consistency. Tools like Laravel’s `DatabaseMigrations` or Dockerized test databases help simulate production environments.
What’s the performance impact compared to Laravel’s migrations?
Performance varies by schema complexity. Doctrine migrations may be slower for large schemas due to SQL generation overhead, but they’re more reliable for complex DDL (e.g., multi-table constraints). Benchmark in staging with your actual migration scripts. For CI, prioritize speed by running migrations in parallel where possible.
Are there alternatives to this bundle for Laravel + Doctrine?
Yes. For standalone Doctrine migrations, use `doctrine/doctrine-migrations` without the Symfony bundle. If you need Laravel-native integration, consider `spatie/laravel-doctrine-orm` (for ORM setup) or stick with Laravel’s migrations for simplicity. This bundle is best if you’re deeply invested in Doctrine’s schema-aware workflows.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport