I am using liquibase community edition (v4.21.1) for redshift database migration.Since liquibase doesn’t come with out-of-box drivers for redshift, I downloaded and placed it under my-project/lib folder.The jar files are redshift-jdbc42-2.1.0.9.jar and liquibase-redshift-4.21.1.jar.RootChangelog file is also kept under my-project/lib folder.liquibase.properties file is kept in root directory which is my-project/
The classpath and changelof property in liquibase.properties looks as below:
classpath=/liquibase/changelog:/liquibase/classpath/redshift-jdbc42-2.1.0.9.jar:/liquibase/classpath/liquibase-redshift-4.21.1.jar
changeLogFile=changelog/lib/update.xml
Now, running below docker command to execute a migration:
docker run --rm -v /path/to/my-project:/liquibase/changelog -v /path/to/my-project/lib:/liquibase/classpath liquibase/liquibase:4.21.1 --defaultsFile=/liquibase/changelog/liquibase.properties update
The above command is throwing error as : Unexpected error running Liquibase: ERROR: syntax error at or near “TAG”
Position: 293 [Failed SQL: (0) CREATE TABLE public.DATABASECHANGELOG_TEST (ID VARCHAR(255) NOT NULL, AUTHOR VARCHAR(255) NOT NULL, FILENAME VARCHAR(255) NOT NULL, DATEEXECUTED datetime NOT NULL, ORDEREXECUTED INT NOT NULL, EXECTYPE VARCHAR(10) NOT NULL, MD5SUM VARCHAR(35), DESCRIPTION VARCHAR(255), COMMENTS VARCHAR(255), TAG VARCHAR(255), LIQUIBASE VARCHAR(20), CONTEXTS VARCHAR(255), LABELS VARCHAR(255), DEPLOYMENT_ID VARCHAR(10))]
It appears to me that liquibase is unable to locate liquibase extension to redshift jar file.
Hi @PJatLiquibase,
Thanks for your reply.
I was able to follow the page and the comment from @nvoxland helped in fixing the issue.So what I did:
Changed my docker command to mount jar files folder to /liquibase/lib (and not /liquibase/classpath)
docker run --rm -v /path/to/my-project:/liquibase/changelog -v /path/to/my-project/lib:/liquibase/lib liquibase/liquibase:4.21.1 --defaultsFile=/liquibase/changelog/liquibase.properties update
Changed my classpath property in liquibase.properties file accordingly:
classpath=/liquibase/changelog:/liquibase/lib/redshift-jdbc42-2.1.0.9.jar:/liquibase/lib/liquibase-redshift-4.21.1.jar
The ’ Drivers and Extensions’ section of Docker needs to be changed.
Thanks again.