首页 > 解决方案 > liquibase databasechangelog table in updateSql mode

问题描述

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.

标签: sqlcommand-linemigrationliquibase

解决方案


有一种方法可以通过使用outputLiquibaseSqlurl 中的参数来包含 databasechangelog 表

.\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

这有时会导致 CMD 或 PowerShell 出现问题(因为问号),因此将其包含在 liquibase.properties 文件中会很有帮助。


推荐阅读