Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add service migrations#629

Merged
greg0ire merged 1 commit into
doctrine:3.7.xfrom
HypeMC:service-migrations
Nov 15, 2025
Merged

Add service migrations#629
greg0ire merged 1 commit into
doctrine:3.7.xfrom
HypeMC:service-migrations

Conversation

@HypeMC
Copy link
Copy Markdown
Contributor

@HypeMC HypeMC commented Nov 12, 2025

A continuation of #524.

Unlike the previous PR, which attempted to support both migrations as services and regular migrations, this one introduces a new enable_service_migrations option, which greatly simplifies the overall implementation.

When enabled, Doctrine will fetch migrations from Symfony’s service container.

To use migrations as services, they need to be autoloadable. IMO, the best approach is to place them inside your src directory, for example:

doctrine_migrations:
+   enable_service_migrations: true
    migrations_paths:
-       'DoctrineMigrations': '%kernel.project_dir%/migrations'
+       'App\Migrations': '%kernel.project_dir%/src/Migrations'

@HypeMC HypeMC force-pushed the service-migrations branch from 444fe00 to d657913 Compare November 12, 2025 21:21
Copy link
Copy Markdown
Member

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add documentation in docs/index.rst

Comment thread src/DependencyInjection/CompilerPass/RegisterMigrationsPass.php Outdated
Comment thread src/DependencyInjection/Configuration.php Outdated
Comment thread src/MigrationsRepository/ServiceMigrationsRepository.php Outdated
Comment thread src/MigrationsRepository/ServiceMigrationsRepository.php Outdated
@HypeMC HypeMC force-pushed the service-migrations branch from d657913 to a03b6a3 Compare November 12, 2025 23:48
@HypeMC
Copy link
Copy Markdown
Contributor Author

HypeMC commented Nov 12, 2025

@greg0ire I've updated the documentation. Please let me know if it's ok.

@greg0ire greg0ire added this to the 3.7.0 milestone Nov 14, 2025
Comment thread src/DependencyInjection/CompilerPass/RegisterMigrationsPass.php
Comment thread docs/index.rst
@greg0ire greg0ire merged commit 1e380c6 into doctrine:3.7.x Nov 15, 2025
15 checks passed
@greg0ire
Copy link
Copy Markdown
Member

Thanks @HypeMC !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants