迁移期间无法解析存储过程

时间:2012-11-22 13:26:05

标签: hsqldb flyway

我正在使用flyway 1.7的api来迁移hsql数据库。   我有一些存储过程的问题。以下脚本工作正常   使用hsql数据库管理器:

CREATE TABLE CUSTOMER (
  firstname VARCHAR(50),
  lastname VARCHAR(50),
  mod_ts TIMESTAMP
);

CREATE PROCEDURE new_customer(firstname VARCHAR(50), lastname VARCHAR(50), address VARCHAR(100))
  MODIFIES SQL DATA
    BEGIN ATOMIC
    INSERT INTO CUSTOMER VALUES (firstname, lastname, CURRENT_TIMESTAMP);
  END

但我认为在飞路迁移过程中,脚本没有正确解析(看起来像 flyway认为第二个声明在分号后结束。

以下是相应的日志输出:

DEBUG 2012-11-22 14:16:00,232 [main] (SqlScript.java:161) - Found statement at line 1: create table CUSTOMER (
firstname varchar(50),
lastname varchar(50),
mod_ts timestamp
);
DEBUG 2012-11-22 14:16:00,232 [main] (SqlScript.java:161) - Found statement at line 7: CREATE PROCEDURE new_customer(firstname VARCHAR(50), lastname VARCHAR(50), address VARCHAR(100))
MODIFIES SQL DATA
BEGIN ATOMIC
INSERT INTO CUSTOMER VALUES (firstname, lastname, CURRENT_TIMESTAMP);
DEBUG 2012-11-22 14:16:00,232 [main] (SqlStatement.java:75) - Executing SQL: create table CUSTOMER (
firstname varchar(50),
lastname varchar(50),
mod_ts timestamp
)
DEBUG 2012-11-22 14:16:00,232 [main] (SqlStatement.java:75) - Executing SQL: CREATE PROCEDURE new_customer(firstname VARCHAR(50), lastname VARCHAR(50), address VARCHAR(100))
MODIFIES SQL DATA
BEGIN ATOMIC
INSERT INTO CUSTOMER VALUES (firstname, lastname, CURRENT_TIMESTAMP)
ERROR 2012-11-22 14:16:00,232 [main] (DbMigrator.java:231) - com.googlecode.flyway.core.exception.FlywayException: Error executing statement at line 7: CREATE PROCEDURE new_customer(firstname VARCHAR(50), lastname VARCHAR(50), address VARCHAR(100))
MODIFIES SQL DATA
BEGIN ATOMIC
INSERT INTO CUSTOMER VALUES (firstname, lastname, CURRENT_TIMESTAMP)
ERROR 2012-11-22 14:16:00,232 [main] (DbMigrator.java:236) - Caused by org.hsqldb.HsqlException: unexpected end of statement:  required: ; : line: 4

有没有办法解决这个问题?

编辑我刚做了一个有趣的观察。如果我使用flyway命令行程序, 然后它完美地运作。

1 个答案:

答案 0 :(得分:1)

升级到Flyway 2.0。它在Hsql中添加了对BEGIN ATOMIC块的支持。