sunnyflail/doctrine-migration-schema-updater 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sunnyflail/doctrine-migration-schema-updater

最新稳定版本:1.0.7

Composer 安装命令:

composer require sunnyflail/doctrine-migration-schema-updater

包简介

Simple doctrine migrations overrider

README 文档

README

This package provides a flexible way to introduce custom schema generation logic that integrates seamlessly with the doctrine:migrations:diff command.
Custom changes applied through this mechanism will persist across schema updates, ensuring your modifications are retained automatically.

Symfony Integration

1. Register the Bundle

Add the bundle to your config/bundles.php file:

SunnyFlail\DoctrineMigrationSchemaUpdater\Symfony\DoctrineSchemaUpdaterBundle::class => ['dev' => true],

Once registered, the bundle is active — but note that it does not alter your schema by default.

2. Default Schema Updater

The bundle includes one built-in schema updater:

SunnyFlail\DoctrineMigrationSchemaUpdater\SchemaUpdater\EmbeddableSchemaUpdater

This updater is automatically available for dependency injection but requires additional configuration to function properly.

If you want to modify the schema generated for entities containing embedded objects, implement the following interface:

SunnyFlail\DoctrineMigrationSchemaUpdater\SchemaUpdater\UpdateEmbeddableSchemaInterface

Then, register your service and tag it as follows:

tags:
  - { name: 'doctrine.migrations.schema_updater.embeddable_schema_updater' }

3. Implementing Custom Schema Updaters

For more advanced schema modification logic, you can create your own schema updater by implementing:

SunnyFlail\DoctrineMigrationSchemaUpdater\SchemaUpdater\SchemaUpdaterInterface

and tagging it as:

tags:
  - { name: 'doctrine.migrations.schema_updater.schema_updater' }

This allows you to define complex schema transformations that will be automatically included in the Doctrine migration diff.

4. Further Configuration

For detailed configuration options and customization possibilities, refer to the compiler pass and bundle configuration services.yaml

SunnyFlail\DoctrineMigrationSchemaUpdater\Symfony\DependencyInjection\CompilerPass\CustomConfigureDependencyFactoryPass

Summary:

  • Integrates with Doctrine’s migration diff process.
  • Preserves custom schema changes across migrations.
  • Easily extendable via tagged schema updaters.

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-23