From 962ec9e70553b6c391c0b8943af90b7cf05f8071 Mon Sep 17 00:00:00 2001 From: Chakradhar Cholleti <160482195+HtSpChakradharCholleti@users.noreply.github.com> Date: Sun, 8 Sep 2024 16:01:04 +0530 Subject: [PATCH] fix triggers creation failing for all the tables after the table name containing hyphen in it --- src/Sniffer/MysqlTriggerBasedTableSniffer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sniffer/MysqlTriggerBasedTableSniffer.php b/src/Sniffer/MysqlTriggerBasedTableSniffer.php index bfab4b9..350e2b5 100644 --- a/src/Sniffer/MysqlTriggerBasedTableSniffer.php +++ b/src/Sniffer/MysqlTriggerBasedTableSniffer.php @@ -54,7 +54,7 @@ public function createTriggers(): void $stmts = ""; foreach ($this->getAllTablesExceptPhinxlogsAndCollector(true) as $table) { $stmts .= " - CREATE TRIGGER {$this->getTriggerName($table)} AFTER INSERT ON `{$table}` + CREATE TRIGGER `{$this->getTriggerName($table)}` AFTER INSERT ON `{$table}` FOR EACH ROW INSERT IGNORE INTO {$this->collectorName()} VALUES ('{$table}'); ";