问题
When I generate a SQL file out of my changelog file the databasechangelog table is created as a CSV file in the same folder as my generated SQL file but I want it as a table inside of my SQL file. I use liquibase 3.5.5. via command line and used this command:
.\liquibase --url=offline:mssql? `
--changeLogFile="C:\Users\Ferid\Documents\Box Sync\PRIVATE_Ferid\liquibase-3.5.5-bin\Changelog.xml" `
--outputFile="C:\Users\Ferid\Documents\Box Sync\PRIVATE_Ferid\liquibase-3.5.5-bin\all.sql" `
updatesql
I did not find a command which integrates the databasechangelog table in the SQL file. It is only integrated when I use the update
statement instead of updatesql
but I need the SQL file.
回答1:
There is a way to include the databasechangelog table by using the outputLiquibaseSql
parameter in the url
.\liquibase --url=offline:mssql?outputLiquibaseSql=true `
--changeLogFile="C:\Users\Ferid\Documents\Box Sync\PRIVATE_Ferid\liquibase-3.5.5-bin\Changelog.xml" `
--outputFile="C:\Users\Ferid\Documents\Box Sync\PRIVATE_Ferid\liquibase-3.5.5-bin\all.sql" `
updatesql
This causes sometimes trouble with CMD or PowerShell (because of the questionmark) so it can be helpful to include it in the liquibase.properties file.
回答2:
You need to change the URL you are using to a non-offline version.
来源:https://stackoverflow.com/questions/52335076/liquibase-databasechangelog-table-in-updatesql-mode