使用Oracle进行Flyway回调 [英] Flyway callbacks with Oracle compile

查看:237
本文介绍了使用Oracle进行Flyway回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在迁移之前和迁移之后添加脚本,作为flyway的回调,以用于编译我的视图,过程,函数等. 是否有可能在迁移过程之前将其停止,或者在脚本失败之前或之后(或者返回警告)进行回滚?

I try to add before migration and after migration scripts as callbacks to flyway for compiling my views, procedures, functions etc. Is there a possibility to stop it before a migration process or have a rollback when before or after scripts fail (or rather return a warning)?

因为我现在唯一看到的就是收到这样的警告

Cause the only thing I see right now is I receive warnings like this

[WARNING] DB:警告:执行完成并显示警告(SQL状态:99999-错误代码:17110)

[WARNING] DB: Warning: execution completed with warning (SQL State: 99999 - Error Code: 17110)

,它继续运行,没有停止. 我考虑过FlywayCallback接口及其实现,但是我不确定如何在编译时完成它.

and it goes on, without stopping. I thought about FlywayCallback interface and it's implementation but I'm not entirely sure how it should be done with compiling.

我正在使用带有最新Flyway的Spring Boot 1.2.5.

I'm using Spring Boot 1.2.5 with the newest Flyway.

推荐答案

我也有同样的错误. SQL State: 99999 - Error Code: 17110.我找到了这个解决方案. 检查此警告下的版本以及sql脚本下的那个版本是否具有触发器或未正确关闭的任何过程.

I have also same error. SQL State: 99999 - Error Code: 17110. i found this solution. check which version under this warning and that version under sql script check have Trigger or any procedure which not closed properly.

关闭触发器或触发器oracle DB /结束时的任何过程.

close trigger or any procedure if oracle DB / end of trigger.

例如:

CREATE OR REPLACE TRIGGER Print_salary_changes
  BEFORE DELETE OR INSERT OR UPDATE ON Emp_tab
  FOR EACH ROW
WHEN (new.Empno > 0)
DECLARE
    sal_diff number;
BEGIN
    sal_diff  := :new.sal  - :old.sal;
    dbms_output.put('Old salary: ' || :old.sal);
    dbms_output.put('  New salary: ' || :new.sal);
    dbms_output.put_line('  Difference ' || sal_diff);
END;
/

这篇关于使用Oracle进行Flyway回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆