【发布时间】:2014-04-11 18:08:14
【问题描述】:
我正在尝试进行稍微尴尬的数据库迁移,并且我正在使用存储过程来更新我的一个应用程序表中的一些行。如果我使用 mysql 命令行工具或在 Sequel Pro 中执行存储过程,它运行正常,但是如果我尝试使用数据库迁移插件运行它,它不会运行。
貌似liquibase支持存储过程,但是数据库迁移插件好像炸了。有谁知道这是否应该工作?
错误(和完整的存储过程)如下所示:
2014-03-08 09:05:21,693 [localhost-startStop-1] INFO liquibase - ChangeSet changelog_fb_contactForm_2_add_new_enquiry_roles.groovy::1393960870500-1::rcgeorge23 ran successfully in 6671ms
| Error 2014-03-08 09:05:21,704 [localhost-startStop-1] ERROR liquibase - Change Set changelog_fb_contactForm_3_add_enquiry_flexible_model_definition_to_existing_organisations.groovy::1393960870500-1::rcgeorge23
failed. Error: Error executing SQL DELIMITER //
CREATE PROCEDURE ABC()
BEGIN
REPEAT
set @organisationConfigurationId = (select id from organisation_configuration oc where oc.enquiry_flexible_model_definition_id is null limit 1);
insert into flexible_model_definition (`version`, `name`) values ('0', 'enquiry.flexible.model');
set @newlyInsertedEnquiryFlexibleModelDefinitionId = LAST_INSERT_ID();
update organisation_configuration oc set oc.enquiry_flexible_model_definition_id = @newlyInsertedEnquiryFlexibleModelDefinitionId where oc.id = @organisationConfigurationId
;
UNTIL 0 = (select count(*) from organisation_configuration oc where oc.enquiry_flexible_model_definition_id is null)
END REPEAT;
END //: 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 PROCEDURE ABC()
BEGIN
REPEAT
set @organis' at line 1
Message: Error executing SQL DELIMITER //
CREATE PROCEDURE ABC()
BEGIN
REPEAT
set @organisationConfigurationId = (select id from organisation_configuration oc where oc.enquiry_flexible_model_definition_id is null limit 1);
insert into flexible_model_definition (`version`, `name`) values ('0', 'enquiry.flexible.model');
set @newlyInsertedEnquiryFlexibleModelDefinitionId = LAST_INSERT_ID();
update organisation_configuration oc set oc.enquiry_flexible_model_definition_id = @newlyInsertedEnquiryFlexibleModelDefinitionId where oc.id = @organisationConfigurationId
;
UNTIL 0 = (select count(*) from organisation_configuration oc where oc.enquiry_flexible_model_definition_id is null)
END REPEAT;
END //: 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 PROCEDURE ABC()
BEGIN
REPEAT
set @organis' at line 1
Line | Method
->> 62 | execute in liquibase.executor.jvm.JdbcExecutor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 104 | execute in ''
| 1091 | execute . . . . . . . . . . . in liquibase.database.AbstractDatabase
| 1075 | executeStatements in ''
| 317 | execute . . . . . . . . . . . in liquibase.changelog.ChangeSet
| 27 | visit in liquibase.changelog.visitor.UpdateVisitor
| 58 | run . . . . . . . . . . . . . in liquibase.changelog.ChangeLogIterator
....
【问题讨论】:
标签: mysql grails database-migration