I have been trying to get this trigger created using Play 2.0.3. It runs perfectly fine in MySQL if I run it manually, but it fails when trying to run it from Play.
delimiter |
create trigger company_updated before update on company
for each row begin
set new.updated = CURRENT_TIMESTAMP;
end;
|
delimiter ;
The error it throws is this:
We got the following error: 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 ‘delimiter | create trigger company_updated before update on company for each row’ at line 1 [ERROR:1064, SQLSTATE:42000], while trying to run this SQL script:
The
delimiterkeyword is not a SQL statement, it is only used in the mysql command line client.Try to remove the
delimiterparts:But as you mentioned, you may hit a Play bug with the semi-colon 🙁