I have two different redshift databases which have multiple schemas in them . When I use diffChangelog with appropriate parameters , liquibase generates a dbchangelog.sql file which consist of changesets. But those changesets are only with respect to public schema and doesn’t include other schemas. How to use diffChangelog to get changesets for all schemas ?
Could you please share the exact command you have tried to generate changelog file?
This will help to provide details about what went wrong.
Also please provide the Liquibase version you are currently using.
Liquibase version : 4.3.5
Command used :
Both databases are redshift
There are below ways you can achieve your goal:
- Using DB snapshot as provided on this link.
diffChangeLogcommand specifying the snapshot (an offline mode) and the database with new changes:
liquibase --referenceUrl=jdbc:postgresql://localhost:5432/MYDATABASE --url=offline:postgresql?snapshot=mySnapshot.json --changeLogFile=mydiffchangelog.xml diffChangeLog
The generated changelog will contain new changes. Now, you can compare and confirm those changes.
- The other way is you can use below command:
liquibase --changeLogFile=dbchangelog.xml --outputFile=mydiff.txt --url= --username= --password= --defaultSchemaName= diffChangeLog --referenceUrl= --referenceUsername= --referencePassword= --referenceDefaultSchemaName=
Just provide one schema name at a time to generate diff results. (Should work with more than one schema names as well, haven’t tried)
- You can also try this command:
liquibase --changeLogFile=dbchangelog.xml --outputFile=mydiff.txt --url= --username= --password= --schemas= <all comma separated schema names goes here> diffChangeLog --referenceUrl= --referenceUsername= --referencePassword=
This should also work.
Please give these a try and let us know the results.
Thank you very much @rakhi