andreo/eventsauce-migration-generator

This component generates doctrine migrations per aggregate.

3.2 2023-02-25 15:58 UTC

This package is auto-updated.

Last update: 2024-11-25 20:07:03 UTC


README

Command to generate doctrine migrations per aggregate

About table schema

Installation

composer require andreo/eventsauce-migration-generator

Previous versions doc

Requirements

  • PHP >=8.2
  • Symfony console ^6.0

Config doctrine migrations

In the first step, configure the doctrine migrations package

Usage

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

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

Change table name suffix

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

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

Generate command

andreo:eventsauce:doctrine-migrations:generate

Command options

prefix table name

  • required
  • string

Generate migration with foo prefix

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

--schema=all

  • optional
  • string[]
  • available values: event, outbox, snapshot, all
  • default value: all

Generate migration for given schemas

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

--uuid-type=binary

  • optional
  • one of: binary, string
  • default value: binary