Ross
June 16, 2021, 2:59pm
1
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 ?
rakhi
June 18, 2021, 5:40am
2
Hi @Ross
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.
Thanks,
Rakhi Agrawal
Ross
June 18, 2021, 6:48am
3
Liquibase version : 4.3.5
Command used :
liquibase
–changeLogFile=dbchangelog.xml
–outputFile=mydiff.txt
–url=
–username=
–password=
diffChangeLog
–referenceUrl=
–referenceUsername=
–referencePassword=
Both databases are redshift
rakhi
June 18, 2021, 9:22am
4
Hey @Ross
There are below ways you can achieve your goal:
Using DB snapshot as provided on this link .
Run the diffChangeLog
command 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.
Thanks!
Rakhi Agrawal
1 Like
Ross
June 18, 2021, 2:01pm
5
Thank you very much @rakhi