如何通过Spring Boot配置文件重命名Liquibase变更日志表?
Absolutely! For your Spring Boot 1.5.3 + Liquibase 3.5.3 stack, you don’t have to rely solely on system properties to rename the Liquibase changelog and lock tables. You can directly set these values in your Spring Boot configuration files (application.properties or application.yml), which is the more idiomatic approach for Spring Boot apps.
Using application.properties
Add these lines to your properties file, replacing the table names with your desired custom names:
# Override default Liquibase changelog table name liquibase.change-log-table=my_custom_db_changelog # Override default Liquibase lock table name liquibase.change-log-lock-table=my_custom_db_changelog_lock
Using application.yml
If you prefer YAML format, use this structure instead:
liquibase: change-log-table: my_custom_db_changelog change-log-lock-table: my_custom_db_changelog_lock
How this works
Spring Boot's auto-configuration for Liquibase (in version 1.5.x) maps these configuration properties directly to Liquibase's internal settings. Specifically:
liquibase.change-log-tablecorresponds to Liquibase'sdatabaseChangeLogTableNameliquibase.change-log-lock-tablecorresponds to Liquibase'sdatabaseChangeLogLockTableName
When your app starts up, Spring Boot will pass these custom values to the Liquibase instance it initializes, so you don’t need any extra code or manual system property setup.
内容的提问来源于stack exchange,提问作者mkhaired




