Weave 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

The Doctrine Migrations Bundle integrates the Doctrine Migrations library into Symfony, adding console commands and configuration to generate, version, run, and roll back database schema migrations. It supports multiple entity managers and connections for managing migrations across complex apps.

View on GitHub
Deep Wiki
Context7

Symfony integration for the doctrine/migrations library

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.
vento/laravel-airbrake
wfeller/laravel-batch
maco-studios/mage-os-installer
busarm/armie
siberfx/laravel-logger
kfteam1991/dcat-admin
dashed/dashed-laposta
dashed/dashed-ecommerce-montaportal
dashed/dashed-ecommerce-etsy
neohq/string-blade-compiler
log1x/acf-composer
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager