andreo/eventsauce-migration-generator
Symfony Console command that generates Doctrine Migrations for EventSauce message storage per aggregate. Configure Doctrine Migrations, then run a single command with a table prefix, selectable schemas (event/outbox/snapshot), UUID type, and optional table-name suffixes.
doctrine/dbal and doctrine/migrations bundles. This ensures seamless compatibility with Laravel’s existing database abstraction layer.symfony/console + symfony/finder).ramsey/uuid (string-based). Requires explicit configuration via --uuid-type.YYYY_MM_DD_HHMMSS_) may need alignment with the package’s output.binary or string UUIDs? If ramsey/uuid, how will conflicts be resolved?doctrine/dbal and doctrine/migrations.laravel/symfony-cli-bridge to expose Symfony commands as Artisan commands.Phase 1: Dependency Setup
composer require andreo/eventsauce-migration-generator doctrine/migrations
composer require symfony/console symfony/finder
config/packages/doctrine_migrations.yaml (Laravel-compatible).Phase 2: CLI Integration
php artisan vendor:publish --provider="Laravel\SymfonyCliBridge\SymfonyCliBridgeServiceProvider"
config/console.php:
'commands' => [
Andreo\EventSauce\Doctrine\Migration\Command\GenerateDoctrineMigrationForEventSauceCommand::class,
],
php artisan andreo:eventsauce:doctrine-migrations:generate my_prefix --schema=event,snapshot
php artisan make:command GenerateEventSauceMigrations
// app/Console/Commands/GenerateEventSauceMigrations.php
use Andreo\EventSauce\Doctrine\Migration\Command\GenerateDoctrineMigrationForEventSauceCommand;
use Doctrine\Migrations\DependencyFactory;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
class GenerateEventSauceMigrations extends Command {
protected $signature = 'eventsauce:migrate {prefix?} {--schema= : event|outbox|snapshot|all} {--uuid-type= : binary|string}';
public function handle() {
$dependencyFactory = new DependencyFactory(
new \Doctrine\DBAL\Connection($this->app['db']->connection()),
new \Doctrine\DBAL\Schema\AbstractSchemaManager($this->app['db']->connection()->getWrappedConnection())
);
$command = new GenerateDoctrineMigrationForEventSauceCommand(
$dependencyFactory,
new \Andreo\EventSauce\Doctrine\Migration\Schema\TableNameSuffix('message_store')
);
$input = new ArrayInput([
'command' => 'andreo:eventsauce:doctrine-migrations:generate',
'prefix' => $this->argument('prefix'),
'--schema' => $this->option('schema'),
'--uuid-type' => $this->option('uuid-type'),
]);
$output = new BufferedOutput();
$command->run($input, $output);
$this->info($output->fetch());
}
}
php artisan eventsauce:migrate user_aggregate --schema=event --uuid-type=string
Phase 3: Configuration
message_store) in the command constructor or via environment variables.binary or string) to match Laravel’s stack (default: binary).doctrine/dbal.ramsey/uuid, set --uuid-type=string to avoid conflicts.YYYY_MM_DD_HHMMSS_ convention via custom naming logic in the wrapper.phpunit-dbunit) to validate schema changes.How can I help you explore Laravel packages today?