Pergunta

I'm using Liquibase 3.1.1 to execute SQL scripts that create compiled database objects such as views, triggers, functions, and procedures.

Is there a changeset attribute that I can set to fail/abort the migration if the database object fails to compile?

For example, if I run a script that creates a trigger and that trigger fails to compile, how can I immediately stop the database migration?

Foi útil?

Solução

Liquibase will automatically fail the upgrade if the database throws an error executing an SQL command. You can override the behavior with the changeSet failOnError attribute, but it defaults true which stops the database update.

If you are seeing Liquibase continue even with bad trigger SQL, your database must be allowing it to be created but then throwing runtime errors when executing it. In that case, you will need a changeSet after the create that checks the view, trigger, etc. either with a precondition or a tag that calls it.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top