正如dropwizard-migrations文档中所提到的,您可以使用以下命令将现有模式转储到migrations.xml
java -jar hello-world.jar db dump helloworld.yml
但我使用的是postgresql,它可以有多个模式,那么我如何配置我的数据库,使其始终获得我正在使用的默认模式的状态/转储,而不是公共模式。
我尝试更改数据库的search_path,但没有成功。
发布于 2014-05-19 14:25:28
Liquibase有一个defaultSchemaName属性。我自己还没有用过dropwizard,但它使用JDBI和一个基于yaml的配置文件seems来连接数据库。那么,您是否尝试过将选项defaultSchemaName放入服务配置文件中,如下所示:
database:
# the name of your JDBC driver
driverClass: org.postgresql.Driver
# the username
user: pg-user
# the password
password: iAMs00perSecrEET
# the JDBC URL
url: jdbc:postgresql://db.example.com/db-prod
# any properties specific to your JDBC driver:
properties:
charSet: UTF-8
defaultSchemaName: <yourSchemaName>发布于 2018-10-12 11:36:10
Jens非常接近,您需要为JDBC驱动程序指定currentSchema而不是defaultSchemaName属性。像这样:
database:
driverClass: org.postgresql.Driver
# the other attributes
properties:
currentSchema: <yourSchemaName>https://stackoverflow.com/questions/23678360
复制相似问题