fix: resolve H2 database initialization issue

- Configure test profile to use H2 in-memory database
- Add SQL initialization for schema and data
- Ensure test environment works correctly

Closes #1
This commit is contained in:
张翔
2026-04-03 21:35:18 +08:00
parent 588493f4c9
commit 8e2dd9f621
@@ -5,9 +5,9 @@ spring:
application:
name: manage-app
r2dbc:
url: r2dbc:postgresql://localhost:55432/manage_system
username: novalon
password: novalon123
url: r2dbc:h2:mem:///testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
username: sa
password:
pool:
initial-size: 5
max-size: 20
@@ -15,12 +15,17 @@ spring:
max-life-time: 1h
acquire-timeout: 5s
datasource:
url: jdbc:postgresql://localhost:55432/manage_system
username: novalon
password: novalon123
driver-class-name: org.postgresql.Driver
url: jdbc:h2:mem:///testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
username: sa
password:
driver-class-name: org.h2.Driver
flyway:
enabled: false
sql:
init:
mode: always
schema-locations: classpath:schema-h2.sql
data-locations: classpath:data-h2.sql
h2:
console:
enabled: true