Skip to content

Problem with Mautic\PluginBundle\Bundle\PluginDatabase installPluginSchema Method #15723

@JonasLudwig1998

Description

@JonasLudwig1998

Mautic Series

7.0.x series

Mautic installed version

7.0.0

Way of installing

I downloaded a release from https://www.mautic.org/mautic-releases

PHP version

8.4.7

What browsers are you seeing the problem on?

Chrome

What happened?

Whenever email queueing is activated in Mautic the method Mautic\PluginBundle\Bundle\PluginDatabase installPluginSchema won't work and result in the error:
500 Internal Server Error - An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'messenger_messages' already exists 

How can we reproduce this issue?

Step 1: Add a new Event Listener which will add execute the method every time after a lead is saved:
`<?php

namespace Mautic\FormBundle\EventListener;

use Mautic\LeadBundle\LeadEvents;
use Mautic\PluginBundle\Bundle\PluginDatabase;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class PluginReloadSubscriber implements EventSubscriberInterface
{
public function __construct(
private PluginDatabase $pluginDatabase,
) {
}
public static function getSubscribedEvents(): array
{
return [
LeadEvents::LEAD_POST_SAVE => ['onLeadPostSave', 0],
];
}

public function onLeadPostSave(): void
{
    $this->pluginDatabase->installPluginSchema([]);
}

}`

Step 2: Change your Queue Settings (Configuration —> Queue Settings) to scheme = doctrine and host = default

Image

Step 3:
Make sure that the db table messenger_messages is created. For me it worked when clearing the cache and then clicking on „Send test message“ in Queue Setting. But test for yourself and make sure the table is loaded

Step 4:
Try to add a lead, when clicking on the save button, the following error should occur: 500 Internal Server Error - An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'messenger_messages' already exists 

Relevant log output

Code of Conduct

  • I confirm that I have read and agree to follow this project's Code of Conduct




Care about this issue? Want to get it resolved sooner? If you are a member of Mautic, you can add some funds to the Bounties Project so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues or PR's relating to bugsneeds-triageFor new issues/PRs that need to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions