gpt4 book ai didi

java - 使用 liquibase 创建 Postgres 数据库

转载 作者:行者123 更新时间:2023-11-30 02:11:03 25 4
gpt4 key购买 nike

我正在尝试使用 liqubase 创建一个空数据库。我用this方法来做到这一点,但问题是它对我不起作用。

我使用 Postgresql 10,下面是我的 Maven 和 liqubase 配置:

 <plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.0.5</version>
<configuration>
<propertyFile>src/main/resources/liquibase/liquibase.properties</propertyFile>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>

还有我的liqubase.properties:

changeLogFile=src/main/resources/liquibase/db.changelog.xml
driver=org.postgresql.Driver
dropFirst=false
url=jdbc:postgresql://localhost:5432/auth?createDatabaseIfNotExist=true
username=postgres
password=root

mvn clean package 上的错误是:

org.postgresql.util.PSQLException: FATAL: database "auth" does not exist

最佳答案

Liquibase 不会创建根本不存在的数据库。我还想象链接的问题/答案中引用的 url 参数 ?createDatabaseIfNotExist=true 可能是 MySql 特定的。

关于java - 使用 liquibase 创建 Postgres 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50118310/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com