sql-server - spring boot中不同数据库的多个数据库模式
问题描述
我有需要在 PCF 上部署的 Spring Boot 应用程序。我想使用 H2 数据库进行本地测试,但在 PCF 中部署后,我将使用 SQL 服务器。我有一个需要用于每个数据库的架构。所以,我有两个 schema.sql 文件,一个用于 H2,另一个用于 SQL Server。如何告诉 spring 需要使用本地配置文件 schema-H2.sql 以及需要使用配置文件云 schema-sqlserver.sql。
解决方案
You can set the spring.datasource.platform to differentiate the schema and data sql file. eg,
spring.datasource.platform=h2
then the file name should be data-h2.sql and schema-h2.sql
Make sure you set spring.datasource.initialization-mode=always
推荐阅读
- python - 如何在python中用两个不同的单词将两个名字拆分在一起
- java - Spotify API Android ADK
- flutter - 颤振/飞镖中的页面浏览量无法滚动
- integration - 将变量 hubspot 同步到 magento 2.4
- popup - Mapbox gl JS popup:强制在对面显示弹出窗口
- azure - Azure 隔离应用服务环境无法使用 Terraform 创建,并显示“发生错误”。
- docker - Grails clean 命令在 Ubuntu docker 容器中给出错误
- github-actions - 如何禁用 GitHub 检查“重新运行”按钮?
- javascript - 在 S3 中启用了 CORS,但遇到了 CORB 问题
- javascript - 如何忽略列表对象中的空字符串?