zenstruck / messenger-test

Assertions and helpers for testing your symfony/messenger queues.
MIT License
218 stars 15 forks source link

DoctrineTransport table dropped when running `doctrine:schema:update` #78

Closed bendavies closed 3 months ago

bendavies commented 3 months ago

Hi,

In CI, we run

APP_ENV=test bin/console doctrine:schema:update --dump-sql --complete --ansi --no-interaction

to ensure that our schema in sync with the database. However this produced DROP TABLE messenger_messages when using this bundle because this check fails, as the transport is actually Zenstruck\Messenger\Test\Transport\TestTransport

https://github.com/symfony/symfony/blob/9b323c6866078f1bc761d7cc34297c41815108d3/src/Symfony/Bridge/Doctrine/SchemaListener/MessengerTransportDoctrineSchemaListener.php#L39

Is there a way to fix this, apart from running with APP_ENV=prod instead?

Thans!

kbond commented 3 months ago

Hmm, in your test env, could you create a dummy/unused transport that uses doctrine?

bendavies commented 3 months ago

ahh ok, a single one NOT using test://?

ok i'll try that!

kbond commented 3 months ago

a single one NOT using test://?

yep, exactly!

bendavies commented 3 months ago

that'll work! thank