Uta*_*dru 4 liquibase maven spring-boot
我在 jdk 11 上有一个 spring-boot 应用程序,使用 maven,具有以下 liquibase 依赖项:
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.6.2</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
更改日志主文件名为 db.changelog.xml ,位于 PROIECTTEST\src\main\resources\db 下,在 application.properties 上具有以下配置:
spring.liquibase.change-log=classpath:/db/db.changelog.xml
spring.liquibase.default-schema=public
liquibase.parameters.schema=public
Run Code Online (Sandbox Code Playgroud)
看起来像:
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<include relativeToChangelogFile="true" file="changelog/initial/test.xml"/>
</databaseChangeLog>
Run Code Online (Sandbox Code Playgroud)
我的变更集 test.xml 文件位于 PROIECTTEST\src\main\resources\db\changelog\initial 看起来像:
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="test" id="1540963204914-19">
<sql >
select * from ${schema}.test
</sql>
</changeSet>
</databaseChangeLog>
Run Code Online (Sandbox Code Playgroud)
当我使用命令 mvn spring-boot:run 启动 spring-boot 服务器时,liquibase sql 失败并出现以下错误:“$”处或附近的语法错误。
我错过了什么吗?从我读到的 application.properties 上的属性是所有需要的,并通过 ${propertyName} 在您的更改日志文件中使用它。
我在一段时间内发现了它......,只是我的秘密我使用了 liquibase.parameters.schema 而不是 spring.liquibase.parameters.schema 。
归档时间: |
|
查看次数: |
3690 次 |
最近记录: |