Mysql dump comments directives and simple comments

╄→尐↘猪︶ㄣ 提交于 2019-12-11 18:39:45

问题


We are planing to use Flyway to manage our migrations because it seams to be a great tool that could perfectly suit our needs. What we have today is MySQL databases for development, and mysql - oracle DB for production cycle.

It seems impossible today with Flyway integrated with ant to deal with simple comments that are into mysqldump comments directives. It looks like this :

/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `lockObject`(
    IN parTypeId INTEGER,
    IN parObjectId INTEGER,
    IN parUserId INTEGER,
    IN parLockTime INTEGER,
    OUT parSuccess BOOLEAN,
    OUT parLockedOn INTEGER, /* time is elapsing from the beginning */
    OUT parErrUserId INTEGER)
BEGIN

    #proc declaration

END */;;

A Flyway migration return the following error

com.googlecode.flyway.core.api.FlywayException: Error executing statement at line 10807:    OUT parErrUserId INTEGER)
BEGIN
    DECLARE locTableName CHAR(50)
Caused by com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'OUT parErrUserId INTEGER)

Is there somewhere something I missed that could permit to deal with this "comment" imbrication issue ?

Regards


回答1:


Put the comments on a new line and you should be good to go. Flyway's parser currently has trouble dealing with end of line comments and multiple statements per line.

I am plan on addressing this in time for 2.2. Until then, please use this workaround.



来源:https://stackoverflow.com/questions/16036990/mysql-dump-comments-directives-and-simple-comments

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!