Skip to content

[Messenger] running php bin/console make:migration with auto_setup: true #37626

@tommym9

Description

@tommym9

Symfony version(s) affected: 5.0.8

Description
I installed the messenger component and setup the default transport to be doctrine. I left the auto_setup config to true and the messenger_messages table was created and thats all working fine.

The issue I've got is when I next ran php bin/console make:migration as I'd added a new Entity, the migration dropped the messenger_messages table:

public function up(Schema $schema) : void
    {
        // this up() migration is auto-generated, please modify it to your needs
     
       // Redacted queries to add my entity here

        $this->addSql('DROP TABLE messenger_messages');
    }

How to reproduce

  • Install messenger composer require symfony/messenger
  • Set doctrine://default as the messenger transport
  • Push a message to the queue
  • See that the table messenger_messages is created
  • Add an entity via the cli
  • Run php bin/console make:migration
  • See that the latest migration has a drop statement for the messenger_messages table

Possible Solution
If auto_setup is true then exclude the messenger_messages from any future migrations.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions