首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Spring、Quarkus、Flyway、Hibernate和多租户的所有模式中运行迁移?

如何在Spring、Quarkus、Flyway、Hibernate和多租户的所有模式中运行迁移?
EN

Stack Overflow用户
提问于 2021-03-09 10:55:12
回答 1查看 632关注 0票数 0

早上好,我正在尝试建立一个QUARKUS项目,包括天桥、hibernate、panache和多租户。但是脚本只在第一个模式上运行一次,有人知道如何在其他模式上运行吗?

application.yml

代码语言:javascript
复制
 datasource:
   db-kind: postgres
   username: postgres
   password: 1234
   jdbc:
     url: jdbc:postgresql://localhost:5432/postgres
     driver: org.postgresql.Driver
 hibernate-orm:
   multitenant: SCHEMA
   dialect: org.hibernate.dialect.PostgreSQLDialect
   log:
     sql: true
 flyway:
   migrate-at-start: true
   baseline-on-migrate: true
   baseline-version: 1.0.0
   create-schemas: true
   clean-at-start: true
   schemas: maripa, bicas, rhino
   locations: db/migration/maripa, db/migration/bicas, db/migration/rhino

日志

代码语言:javascript
复制
    __  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
2021-03-09 07:41:54,213 INFO  [io.qua.fly.FlywayProcessor] (build-13) Adding application migrations in path '/home/idd_acosta/freelas/rhino/rhino-api/target/classes/db/migration/maripa/' using protocol 'file'
2021-03-09 07:41:54,844 INFO  [io.qua.arc.pro.BeanProcessor] (build-8) Found unrecommended usage of private members (use package-private instead) in application beans:
    - @Inject field br.com.rhino.user.mapper.RoleMapperImpl#permissionMapper,
    - @Inject field br.com.rhino.user.mapper.UserMapperImpl#roleMapper
2021-03-09 07:41:56,228 INFO  [org.fly.cor.int.lic.VersionPrinter] (Quarkus Main Thread) Flyway Community Edition 7.5.2 by Redgate
2021-03-09 07:41:56,348 INFO  [org.fly.cor.int.dat.bas.DatabaseType] (Quarkus Main Thread) Database: jdbc:postgresql://localhost:5432/postgres (PostgreSQL 13.1)
2021-03-09 07:41:56,380 INFO  [org.fly.cor.int.com.DbClean] (Quarkus Main Thread) Successfully dropped pre-schema database level objects (execution time 00:00.001s)
2021-03-09 07:41:56,426 INFO  [org.fly.cor.int.com.DbClean] (Quarkus Main Thread) Successfully dropped schema "maripa" (execution time 00:00.044s)
2021-03-09 07:41:56,428 INFO  [org.fly.cor.int.com.DbClean] (Quarkus Main Thread) Successfully dropped schema " bicas" (execution time 00:00.001s)
2021-03-09 07:41:56,430 INFO  [org.fly.cor.int.com.DbClean] (Quarkus Main Thread) Successfully dropped schema " rhino" (execution time 00:00.001s)
2021-03-09 07:41:56,430 INFO  [org.fly.cor.int.com.DbClean] (Quarkus Main Thread) Successfully dropped post-schema database level objects (execution time 00:00.000s)
2021-03-09 07:41:56,432 INFO  [org.fly.cor.int.lic.VersionPrinter] (Quarkus Main Thread) Flyway Community Edition 7.5.2 by Redgate
2021-03-09 07:41:56,437 INFO  [org.fly.cor.int.dat.bas.Schema] (Quarkus Main Thread) Creating schema "maripa" ...
2021-03-09 07:41:56,439 INFO  [org.fly.cor.int.dat.bas.Schema] (Quarkus Main Thread) Creating schema " bicas" ...
2021-03-09 07:41:56,439 INFO  [org.fly.cor.int.dat.bas.Schema] (Quarkus Main Thread) Creating schema " rhino" ...
2021-03-09 07:41:56,443 INFO  [org.fly.cor.int.sch.JdbcTableSchemaHistory] (Quarkus Main Thread) Creating Schema History table "maripa"."flyway_schema_history" ...
2021-03-09 07:41:56,487 INFO  [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Current version of schema "maripa": null
2021-03-09 07:41:56,496 INFO  [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Migrating schema "maripa" to version "1.0.1 - start structure maripa"
2021-03-09 07:41:56,555 INFO  [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Successfully applied 1 migration to schema "maripa" (execution time 00:00.078

我的路

如您所见,它只在第一个模式中运行。这三个人怎么跑?

对不起,我的英语!:)

EN

回答 1

Stack Overflow用户

发布于 2022-02-07 22:31:15

这个问题提出得很晚,但从夸库斯博士的角度来看,这似乎是经过设计的。

Flyway的架构历史表的名称。默认情况下(单模式模式),模式历史表被放置在数据源提供的连接的默认架构中。设置flyway.schemas属性(多模式模式)时,模式历史表将放置在列表的第一个架构中。

我想它只需要一个模式表,因为所有三个‘租户’都应该保持在相同的版本?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66545530

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档