Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8f325f5

Browse filesBrowse files
committed
bug #40055 [Messenger] Fix Doctrine setup when using a migration (fabpot)
This PR was merged into the 5.2 branch. Discussion ---------- [Messenger] Fix Doctrine setup when using a migration | Q | A | ------------- | --- | Branch? | 5.2 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #39928 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | n/a #38136 fixed running `messenger:setup-transports` (issue reported in #37179), but it breaks usage with `make:migration` (reported in #39928) as code is already executed in a transaction. This PR fixes both use cases. Commits ------- 42eeb44 [Messenger] Fix Doctrine setup when using a migration
2 parents a07638b + 42eeb44 commit 8f325f5
Copy full SHA for 8f325f5

File tree

Expand file treeCollapse file tree

1 file changed

+1
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-3
lines changed

‎src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function setup(): void
8787
{
8888
parent::setup();
8989

90-
$this->executeStatement(implode("\n", $this->getTriggerSql()));
90+
$this->executeStatement('BEGIN;'.implode("\n", $this->getTriggerSql()).'COMMIT;');
9191
}
9292

9393
/**
@@ -109,7 +109,6 @@ public function getExtraSetupSqlForTable(Table $createdTable): array
109109
private function getTriggerSql(): array
110110
{
111111
return [
112-
'BEGIN;',
113112
sprintf('LOCK TABLE %s;', $this->configuration['table_name']),
114113
// create trigger function
115114
sprintf(<<<'SQL'
@@ -124,7 +123,6 @@ private function getTriggerSql(): array
124123
// register trigger
125124
sprintf('DROP TRIGGER IF EXISTS notify_trigger ON %s;', $this->configuration['table_name']),
126125
sprintf('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON %1$s FOR EACH ROW EXECUTE PROCEDURE notify_%1$s();', $this->configuration['table_name']),
127-
'COMMIT;',
128126
];
129127
}
130128

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.