Skip to content

Could not create trigger on MySQL #71

@k4jt

Description

@k4jt

`
-- +migrate Up

CREATE TABLE device_groups ...
CREATE TABLE devices ...

-- +migrate StatementBegin
delimiter |

CREATE TRIGGER update_devicegroup_devices_on_insert AFTER INSERT ON devices
FOR EACH ROW
BEGIN
UPDATE device_groups SET devices = (SELECT COUNT(*) FROM devices WHERE device_group_id = NEW.device_group_id) WHERE id = NEW.device_group_id;
END
|

delimiter ;
-- +migrate StatementEnd

-- +migrate Down
DROP TABLE IF EXISTS devices CASCADE;
DROP TABLE IF EXISTS device_groups CASCADE;
`

Using bindata

Error 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 'delimiter |

CREATE TRIGGER update_devicegroup_devices_on_insert AFTER INSERT ON' at line 2 handling 003_reinit.sql

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions