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
-------
7ed93b4dc0
Run postgres setup trigger in transaction
This commit is contained in:
commit
f1fd3c0069
@ -109,6 +109,7 @@ final class PostgreSqlConnection extends Connection
|
|||||||
private function getTriggerSql(): array
|
private function getTriggerSql(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'BEGIN;',
|
||||||
sprintf('LOCK TABLE %s;', $this->configuration['table_name']),
|
sprintf('LOCK TABLE %s;', $this->configuration['table_name']),
|
||||||
// create trigger function
|
// create trigger function
|
||||||
sprintf(<<<'SQL'
|
sprintf(<<<'SQL'
|
||||||
@ -123,6 +124,7 @@ SQL
|
|||||||
// register trigger
|
// register trigger
|
||||||
sprintf('DROP TRIGGER IF EXISTS notify_trigger ON %s;', $this->configuration['table_name']),
|
sprintf('DROP TRIGGER IF EXISTS notify_trigger ON %s;', $this->configuration['table_name']),
|
||||||
sprintf('CREATE TRIGGER notify_trigger AFTER INSERT ON %1$s FOR EACH ROW EXECUTE PROCEDURE notify_%1$s();', $this->configuration['table_name']),
|
sprintf('CREATE TRIGGER notify_trigger AFTER INSERT ON %1$s FOR EACH ROW EXECUTE PROCEDURE notify_%1$s();', $this->configuration['table_name']),
|
||||||
|
'COMMIT;',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user