使用 liquibase 创建 Postgres 数据库

nll*_*dfx 6 java liquibase maven

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

我使用 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>
Run Code Online (Sandbox Code Playgroud)

和我的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
Run Code Online (Sandbox Code Playgroud)

上的错误mvn clean package是:

org.postgresql.util.PSQLException:致命:数据库“auth”不存在

Ste*_*nie 4

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