Does Liquibase changeSet with failOnError = "false" always work?

I am trying to execute the following changeSet in Liquibase, which should create an index. If the index does not exist, it should automatically fail:

 <changeSet failOnError="false" author="sys" id="1"> <createIndex unique="true" indexName="key1" tableName="Table1"> <column name="name" /> </createIndex> </changeSet> 

So far so good. The problem is that this changeSet not in the DATABASECHANGELOG table and therefore is executed every time the libase is executed. According to the liquid packaging documentation and, for example, this answer from Nathen Voxland, I thought that the set of changes should be marked as an escape in the DATABASECHANGELOG table. Instead, it is not registered at all, and, as I said, it is executed every time every time a libase is executed (and fails every time again).

Am I missing something?

(I use MySQL as a DBMS)

+6
source share
1 answer

In the answer given by Nathen Voxland, he recommended a more correct approach to using precondition to check the status of the database before running a set of changes.

It seems to me that ignoring a failure is a bad idea .... means that you do not have full control over the database configuration .... The failOnError parameter allows Liquibase to continue. Wouldn't it be a bad idea for the assembly to write the record as done if it really wasn't because the error occurred?

+3
source

Source: https://habr.com/ru/post/917437/


All Articles