To fix vulnerabilities I upgraded docker image version in my dockerfile:
old:
FROM liquibase/liquibase:4.4
new:
FROM liquibase/liquibase:4.20
But I started to get error:
addAfterColumn is not allowed on postgresql
I started to investigate this error and found out that in some changesets addAfterColumn
is used.
<changeSet author="***" id="***">
<addColumn tableName="my_table" >
<column afterColumn="existing_column"
name="new_column"
type="varchar(255)" >
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
I also found this topic:
https://github.com/liquibase/liquibase/issues/3091
So I just removed afterColumn
but I am not sure what side effects could I experience ? I am not familiar about reason to use afterColumn
but if it is removed it could be useless but I can’t find any useful information.
Are there any other options to fix the issue ? because editing liquibase scripts will break checksums for existing databases
2
Answers
As this pull request shows, previously liquibase did not warn that column ordering might not be applied, because the database does not support it. So it failed silently in older versions, but now it shows an error. Quoting the most important line:
You can try to do suggestion with
modifySql
from here:https://github.com/liquibase/liquibase/issues/3094#issuecomment-1195961510
It looks like in liquibase 4.13 https://github.com/liquibase/liquibase/pull/2943 they fixed something that doesn’t need to be fixed as in https://github.com/liquibase/liquibase/issues/3091 they are trying to enhance/fix their own fix. In addition to breaking backward compatibility (as @gstackoverflow wrote in the comment), it breaks the logic when the product has support for many types of databases (no error for mySQL and error for Oracle/MsSQL/PostgreSQL).