Feature request from adlogic, posted on GitHub Jun 24, 2016
Steps to reproduce
$trigger = $triggerFactory->create();
$trigger->setTable('some_table');
$trigger->setTime(Trigger::TIME_BEFORE);
$trigger->setEvent(Trigger::EVENT_INSERT);
$trigger->setName('some_trigger');
$trigger->addStatement('/* dummy */');
$setup->getConnection()->createTrigger($trigger);
Expected result
Trigger is successfully created.
Actual result
[PDOException] SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';END' at line 13
More info
Magento generates following query:
CREATE TRIGGER some_trigger BEFORE INSERT ON some_table FOR EACH ROW
BEGIN
/* dummy */;
END
So, ::addStatement should use some heuristics for auto-adding semicolon after each statement, or doesn't add it at all.