如何使用Spring Boot和Flyway为Quartz调度器设置数据库模式



我有一个Spring Boot应用程序,它使用Quartz调度器和PostGreSQL数据库作为存储。我正在将它从使用public模式的自己的数据库运行迁移到使用每个应用程序一个模式的共享数据库运行。该架构使用flyway进行管理。

在测试期间(使用testcontainers(,应用程序的启动因而失败

Caused by: org.postgresql.util.PSQLException: ERROR: relation "qrtz_locks" does not exist
Position: 15

尽管flyway先前已经在模式CCD_ 2中创建了该表。

配置为

spring:
jpa.properties:
hibernate.default_schema: app_test_hub_scheduler_v0
flyway:
enabled: true
schemas: app_test_hub_scheduler_v0
jpa:
properties:
hibernate:
default_schema: app_test_hub_scheduler_v0
quartz:
jdbc:
schema: app_test_hub_scheduler_v0
jdbcUrlParams: ?currentSchema=app_test_hub_scheduler_v0

石英特性为

org.quartz.scheduler.instanceName=test-hub-scheduler
org.quartz.scheduler.instanceId=AUTO
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=50
org.quartz.jobStore.misfireThreshold=60000
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.jobStore.useProperties=true
org.quartz.jobStore.dataSource=myDS
org.quartz.jobStore.tablePrefix=qrtz_
org.quartz.jobStore.isClustered=false

石英似乎没有得到模式名称。我该如何设置?

Quartz调度器可以考虑schema_name,如果在Quartz.properties中声明了以下属性。例如

org.quartz.jobStore.tablePrefix=app_test_hub_scheduler_v0.qrtz_

此处

app_test_hub_scheduler_v0 = is schema name and
qrtz_= is quartz table prefix

最新更新