broadway / broadway-bundle

Symfony bundle for broadway/broadway
https://broadway.github.io/broadway-bundle/
MIT License
66 stars 21 forks source link

Where are broadway event-store schema commands? #54

Closed bruli closed 4 years ago

bruli commented 6 years ago

Hi.

I'm installed Broadway bundle in a symfony4 project. But I can't execute broadway commands to create event store schema.

I've got installed:

broadway/broadway                   2.0.1              Infrastructure and testing helpers for creating CQRS and event sourced applications.
broadway/broadway-bundle            0.4.1              Symfony bundle for broadway/broadway.
broadway/event-store-dbal           0.2.0              Event store implementation using doctrine/dbal
broadway/uuid-generator             0.4.0              UUID generator for broadway/broadway.

Registered bundle:

<?php

return [
    JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
    Broadway\Bundle\BroadwayBundle\BroadwayBundle::class => ['all' => true],
    Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
    Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
    ...
];

In config/packages/broadway.yaml

broadway:
  event_store: "my_dbal_event_store"

In config/services.ymal

services:
    my_dbal_event_store:
      class: Broadway\EventStore\Dbal\DBALEventStore
      arguments:
        - "@doctrine.dbal.default_connection"
        - "@broadway.serializer.payload"
        - "@broadway.serializer.metadata"
        - "events"
        - false
        - "@broadway.uuid.converter"

Any idea why I can see commands?. Thks.

HellPat commented 6 years ago

Yes, I have the same problem

bruli commented 6 years ago

Commands was remove from bundle. We need create event table using a migration tool or similar. But the problem is in documentation. Anything was write about it.

HellPat commented 6 years ago

For now I wrote a Doctrine migration. Since I'm just trying out Broadway for the first time I have no experience and the schema might be stupid. E.g. uuids should be stored different or smth like that?!

But if somebody wants to hack around: my migration looks like that.

        $table = $schema->createTable('event_store');
        $table->addColumn('uuid', Type::STRING, [
            'length' => 36,
            'fixed' => true,
        ]);
        $table->addColumn('playhead', Type::INTEGER, [
            'unsigned' => true,
        ]);
        $table->addColumn('payload', Type::TEXT);
        $table->addColumn('metadata', Type::TEXT);
        $table->addColumn('recorded_on', Type::STRING, [
            'length' => 32,
        ]);
        $table->addColumn('type', Type::TEXT);
        $table->addUniqueIndex(['uuid', 'playhead']);
        $table->setPrimaryKey(['uuid']);
kix commented 6 years ago

@bruli, seems like the bundle at ver. 0.4.0 still has the commands, while the new version doesn't; so you could require broadway/broadway at an earlier version (1.x), as well as the bundle at 0.4.0 specifically:

$ composer require broadway/broadway ^1.0
$ composer require broadway/broadway-bundle 0.4.0
othillo commented 6 years ago

@wjzijderveld should we revert this? https://github.com/broadway/broadway-bundle/pull/50/commits/5cc22d5dce4f498c96886f83be53e7838e3130cc

This means adding a dependency on Doctrine. (Arguably just a dev dependency.) Adding these commands to broadway/event-store-dbal requires adding a dependency on symfony/console in that repo.

wjzijderveld commented 6 years ago

I'm not sure, I think it's a bad example to not do it with migrations. But then again, I would also prefer to have a lower entry barrier :-) Maybe add it to the demo instead and link to there in the docs?

arrgson commented 6 years ago

FWIW, example of migration file is available at: https://gist.github.com/arrgson/a8a8163c92995696d4b182011e1e3c0a

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.