私は既存のデータベースに対してliquibaseを正常に実行できますが、データベースの作成も自動化しようとしています。liquibase mavenプラグインからデータベースを作成
私は、以下の設定でMavenプラグインを使用しています:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
</configuration>
<executions>
<execution>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
そして、私のliquibase.propertiesファイルには、次があります。
driver=org.postgresql.Driver
url=jdbc:postgresql://localhost:5432/mydb?createDatabaseIfNotExist=true
username=postgres
password=mypass
changeLogFile=db.changelog.xml
referenceUsername=postgres
referencePassword=${database.password}
別questionによるSO URLパラメータを追加しますcreateDatabaseIfNotExist = trueは、プラグイン更新の目標が実行されたときにdbを作成する必要があります。しかし、次のエラーが表示されます。
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.0:update (default-cli) on project accommodation: Error setting up or running Liquibase: liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: FATAL: database "mydb" does not exist -> [Help 1]
URLパラメータはMySQL固有のものであるため、Postgresでは動作しません。 – SteveDonie