andreo/eventsauce-migration-generator

该组件根据聚合生成doctrine迁移。

3.2 2023-02-25 15:58 UTC

This package is auto-updated.

Last update: 2024-09-25 19:46:08 UTC


README

生成每个聚合的doctrine迁移的命令

关于表架构

安装

composer require andreo/eventsauce-migration-generator

旧版本文档

需求

  • PHP >=8.2
  • Symfony console ^6.0

配置doctrine迁移

在第一步,配置doctrine迁移

用法

use Andreo\EventSauce\Doctrine\Migration\Command\GenerateDoctrineMigrationForEventSauceCommand;

new GenerateDoctrineMigrationForEventSauceCommand(
    dependencyFactory: $dependencyFactory, // instance of Doctrine\Migrations\DependencyFactory
);

更改表名后缀

use Andreo\EventSauce\Doctrine\Migration\Command\GenerateDoctrineMigrationForEventSauceCommand;
use Andreo\EventSauce\Doctrine\Migration\Schema\TableNameSuffix;

new GenerateDoctrineMigrationForEventSauceCommand(
    dependencyFactory: $dependencyFactory,
    tableNameSuffix: new TableNameSuffix(event: 'message_store')
);

生成命令

andreo:eventsauce:doctrine-migrations:generate

命令选项

表名前缀

  • 必需
  • 字符串

使用 foo 前缀生成迁移

php bin/console andreo:eventsauce:doctrine-migrations:generate foo

--schema=all

  • 可选
  • 字符串数组
  • 可用值:event, outbox, snapshot, all
  • 默认值:all

为给定架构生成迁移

php bin/console andreo:eventsauce:doctrine-migrations:generate foo --schema=event --schema=snapshot

--uuid-type=binary

  • 可选
  • 以下之一:binary, string
  • 默认值:binary