如何使用Spring Boot和Flyway为Quartz调度器设置数据库模式? [英] How to set the database schema for the Quartz scheduler with Spring Boot and Flyway?
本文介绍了如何使用Spring Boot和Flyway为Quartz调度器设置数据库模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Spring Boot应用程序,它使用带有PostgreSQL数据库的Quartz调度器作为存储。我正在将它从使用public
模式运行它自己的数据库迁移到使用共享数据库运行,每个应用程序使用一个模式。架构由flyway管理。
在测试期间(使用testcontainers)启动应用程序失败,错误为
Caused by: org.postgresql.util.PSQLException: ERROR: relation "qrtz_locks" does not exist
Position: 15
尽管Flyway以前已在架构app_test_hub_scheduler_v0
中创建了该表。
配置为
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没有得到模式名称。我如何设置它?
推荐答案
如果在Quartz.Properties中声明了以下属性,则Quartz调度程序可以考虑SCHEMA_NAME。例如
org.quartz.jobStore.tablePrefix=app_test_hub_scheduler_v0.qrtz_
此处
app_test_hub_scheduler_v0 = is schema name and
qrtz_= is quartz table prefix
这篇关于如何使用Spring Boot和Flyway为Quartz调度器设置数据库模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文