0

我们计划使用 Flyway 来管理我们的迁移,因为它看起来是一个可以完美满足我们需求的好工具。我们今天拥有的是用于开发的 MySQL 数据库,以及用于生产周期的 mysql - oracle DB。

今天似乎不可能将 Flyway 与 ant 集成来处理 mysqldump 注释指令中的简单注释。它看起来像这样:

/*!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 */;;

Flyway 迁移返回以下错误

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)

有没有我错过的地方可以处理这个“评论”重叠问题?

问候

4

1 回答 1

0

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.

于 2013-04-16T16:28:36.740 回答