I am currently testing deployment on AWS which works flawlessly when using an empty database to begin with. However, when I migrate data from the database on the local development machine to the AWS database, I keep getting liquibase exceptions of the form:
Postgres is being used on the development machine as well as on AWS, both times in docker with the same image. The data is being migrated by first using a dump from the local development machine using
docker exec postgresdb psql -U user -d database -f /home/db.sql
The migration of the data takes place flawlessly and the databases look exactly the same on the local development machine and on AWS.
When the Jmix application is started on the local development machine, no liquibase exceptions are thrown. But when starting the application on AWS, the above mentioned liquibase exceptions (“relation already exists”) are thrown for each table. Why is this happening and what would be the solution to this?
Most probably it’s because when running in docker container built with bootBuildImage, Liquibase determines the path to changelog differently, for example: BOOT-INF/classes/com/company/demo/liquibase/changelog/010-init-user.xml
At the same time when run from IDE or from executable JAR built by bootJar, the path doesn’t contain BOOT-INF/classes.
So if you created the database not by the application in docker, the database contains information about executed changelogs with correct paths. If afterwards you run the application in docker with the same database, Liquibase tries to execute the same chagelogs because they have different paths.