Run postgres setup trigger in transaction
This commit is contained in:
parent
3c5a4ed06e
commit
7ed93b4dc0
@ -109,6 +109,7 @@ final class PostgreSqlConnection extends Connection
|
||||
private function getTriggerSql(): array
|
||||
{
|
||||
return [
|
||||
'BEGIN;',
|
||||
sprintf('LOCK TABLE %s;', $this->configuration['table_name']),
|
||||
// create trigger function
|
||||
sprintf(<<<'SQL'
|
||||
@ -123,6 +124,7 @@ SQL
|
||||
// register trigger
|
||||
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']),
|
||||
'COMMIT;',
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user