Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f1fd3c0

Browse files
bug #38136 [Messenger] Run postgres setup trigger in transaction (akondas)
This PR was merged into the 5.1 branch. Discussion ---------- [Messenger] Run postgres setup trigger in transaction | Q | A | ------------- | --- | Branch? | 5.1 <!-- 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 #37179 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | n/a <!-- required for new features --> This PR fix `messenger:setup-transports` command when using with ` doctrine/doctrine-bundle` version >= 2.1 Commits ------- 7ed93b4 Run postgres setup trigger in transaction
2 parents 4409a30 + 7ed93b4 commit f1fd3c0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public function getExtraSetupSqlForTable(Table $createdTable): array
109109
private function getTriggerSql(): array
110110
{
111111
return [
112+
'BEGIN;',
112113
sprintf('LOCK TABLE %s;', $this->configuration['table_name']),
113114
// create trigger function
114115
sprintf(<<<'SQL'
@@ -123,6 +124,7 @@ private function getTriggerSql(): array
123124
// register trigger
124125
sprintf('DROP TRIGGER IF EXISTS notify_trigger ON %s;', $this->configuration['table_name']),
125126
sprintf('CREATE TRIGGER notify_trigger AFTER INSERT ON %1$s FOR EACH ROW EXECUTE PROCEDURE notify_%1$s();', $this->configuration['table_name']),
127+
'COMMIT;',
126128
];
127129
}
128130

0 commit comments

Comments
 (0)