Bar*_*tek 3 java liquibase spring-boot
我尝试将 H2 用于测试目的添加到 Spring Boot 中application-test.yml
,我的生产数据库是 Oracle。我想通过 liquibase 填充 H2 模式,但收到以下错误:
引起:org.h2.jdbc.JdbcSQLException:找不到表“all_sequences”;SQL语句:
我的配置如下:
spring:
profiles:
active: test
datasource:
url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=Oracle
username: sa
password:
platform: h2
driver-class-name: org.h2.Driver
jpa:
hibernate:
ddl-auto: none
generate-ddl: true
h2:
console:
enabled: true
path: /console
liquibase:
url: ${spring.datasource.url}
enabled: true
user: sa
password:
change-log: classpath:liquibase/test-master.xml
drop-first: true
Run Code Online (Sandbox Code Playgroud)
如何调整上面的配置,我花了几个小时,但不知道如何使它工作。
添加:
jpa:
properties:
hibernate:
org.hibernate.dialect.H2Dialect
Run Code Online (Sandbox Code Playgroud)
解决了问题。
完整配置:
spring:
datasource:
url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=Oracle
username: sa
password:
platform: h2
driver-class-name: org.h2.Driver
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.H2Dialect
hibernate:
ddl-auto: none
generate-ddl: true
liquibase:
url: ${spring.datasource.url}
contexts: test
change-log: classpath:liquibase/test-master.xml
user: sa
password:
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3705 次 |
最近记录: |