rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.23k stars 280 forks source link

DELIMETER breaks migrations? #36

Closed lol768 closed 8 years ago

lol768 commented 8 years ago

Steps to reproduce:

-- +migrate StatementBegin
DELIMITER //
-- +migrate StatementEnd
-- +migrate StatementBegin
CREATE PROCEDURE add_system_role
  (IN name VARCHAR(20), IN display_name VARCHAR(20), IN priority INT UNSIGNED)
  BEGIN
    INSERT INTO `roles` VALUES (NULL, name, display_name, NULL, priority, DEFAULT, DEFAULT);
  END //
-- +migrate StatementEnd
-- +migrate StatementBegin
DELIMITER ;
-- +migrate StatementEnd

Expected: Procedure is created.

Actual: Failed to migrate the database:

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 //\n-- +migrate StatementEnd' at line 2 handling 1_init.sql

Version: 6f4757563362064790a6687a6b60f182062c8634

We are using jteeuwen/go-bindata.

lol768 commented 8 years ago

Delimeters are client-side, misunderstood what was going on