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

Migrations Laravel Package

doctrine/migrations

Doctrine Migrations manages database schema changes via versioned migrations for PHP projects. Generate, run, and track migration scripts, integrate with Doctrine DBAL/ORM, and safely evolve schemas across environments with robust CLI tooling and documentation.

View on GitHub
Deep Wiki
Context7

Doctrine Database Migrations Library

Frequently asked questions about Migrations
Can Doctrine Migrations replace Laravel’s native `php artisan migrate` for managing database schema changes?
Yes, but with trade-offs. Doctrine Migrations uses its own format (YAML/XML/PHP) instead of Laravel’s PHP class-based migrations. For new projects or complex multi-database setups, it’s a powerful alternative. Existing Laravel migrations can coexist if structured carefully, but full replacement requires migration file conversion or parallel adoption.
How do I install and configure Doctrine Migrations in a Laravel project?
Install via Composer: `composer require doctrine/migrations`. Register the configuration in a Laravel service provider (e.g., `AppServiceProvider`) by binding the Doctrine `ConnectionConfiguration` to your database connection. Use the CLI (`doctrine:migrations:execute`) or programmatic API to run migrations. Full setup details are in the [official documentation](https://www.doctrine-project.org/projects/migrations.html).
Does Doctrine Migrations support Laravel’s Eloquent ORM and database connections?
Yes, it integrates seamlessly with Doctrine DBAL, which Laravel already uses under the hood for database interactions. You can leverage Eloquent models and Laravel’s connection configuration (e.g., `DB::connection()`) to manage migrations. This ensures compatibility with Laravel’s primary data access layer.
What Laravel versions are compatible with Doctrine Migrations?
Doctrine Migrations works with Laravel 5.5+ and PHP 7.2+. It relies on Doctrine DBAL, which is already bundled with Laravel. Check the [Doctrine Migrations documentation](https://www.doctrine-project.org/projects/migrations.html) for version-specific requirements, but it’s generally backward-compatible with modern Laravel releases.
How do I test Doctrine Migrations in a CI/CD pipeline?
Use Laravel’s testing tools (e.g., `php artisan migrate:fresh --env=testing`) alongside Doctrine’s CLI commands in your CI pipeline. Test migrations in isolation by spinning up temporary databases (e.g., SQLite for unit tests). Verify rollbacks with `doctrine:migrations:execute --down` and assert schema states using DBAL’s schema comparison tools.
Can I use Doctrine Migrations alongside Laravel Forge or Envoyer for deployments?
Yes, Doctrine Migrations integrates with deployment tools via CLI hooks. Add `doctrine:migrations:execute` to your Forge/Envoyer deployment scripts or use Laravel’s `post-deploy` hooks. For zero-downtime deployments, run migrations in a separate step or use Doctrine’s `--dry-run` flag to preview changes before execution.
What are the performance implications of using Doctrine Migrations vs. Laravel’s native migrations?
Doctrine Migrations introduces minimal overhead due to DBAL’s abstraction layer, but benchmarks show negligible differences in most cases. For large-scale projects, test both approaches in staging. Laravel’s native migrations may offer slight speed advantages for simple schemas, but Doctrine Migrations excels in complex, multi-database, or cross-environment scenarios.
How do I handle rollbacks or fix failed migrations with Doctrine Migrations?
Doctrine Migrations supports rollbacks via `doctrine:migrations:execute --down`. For complex failures (e.g., foreign key constraints), manually create a new migration to correct the schema. Use `--dry-run` to preview changes before execution. Always test rollbacks in a staging environment to avoid production issues.
Are there alternatives to Doctrine Migrations for Laravel database versioning?
Laravel’s native migrations (`php artisan migrate`) are the default choice for simplicity. For advanced use cases, consider **Flysystem Migrations** (for file-based schemas) or **Spatie’s Laravel Migrations Generator** (for scaffolding). Doctrine Migrations stands out for its cross-platform support (YAML/XML/PHP formats) and integration with Doctrine DBAL/ORM.
How do I version-control Doctrine Migrations alongside Laravel code?
Store migration files (e.g., in `database/migrations/doctrine`) in Git alongside your Laravel code. Use Git tags to mark migration versions (e.g., `v1.0.0`) and correlate them with releases. For teams, enforce a workflow where migrations are reviewed and tested like application code to prevent schema drift.
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.
phpshko/laravel-livewire-depdrop
larasell-dev/larasell
calliostro/spotify-bundle
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer