データベースの更新を実行するためにliquibase-maven-pluginを使用しようとしています。liquibase-maven-pluginとsqlFile
<configuration>
<username>${dba.username}</username>
<password>${dba.password}</password>
<url>${caesium.url}</url>
<changeLogFile>master.xml</changeLogFile>
<driver>org.postgresql.Driver</driver>
<includeArtifact>true</includeArtifact>
</configuration>
私のデータベースの変更履歴(およびSQL)ファイルはsrc/main/resourcesに保存されています。私のチェンジセットは以下の通りです:
master.xml:
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<include file="baseline.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
baseline.xml:
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="base-roles" author="asdf" dbms="PostgreSQL">
<sqlFile path="sql/some-file.sql" relativeToChangelogFile="true"/>
</changeSet>
</databaseChangeLog>
一部-file.sqlなので、リソースのSQLサブディレクトリ(に指定されているように、変更ログに対して、は sql/some-file.sqlです。
アラス!上記の構文はうまくいきません! liquibaseによってsqlファイルが見つかりません。
私が絶対パスにメインスクリプトを設定すると、不思議にも、すべて正常に機能します。しかし、それは私がやりたいことではありません(私はdatabasechangelogテーブルに絶対パスを入れたくありません)。
オハイオ州...私は問題が何であるか知っていると思います。メインスクリプトがサブディレクトリにない場合、liquibaseは 'base'ディレクトリを見つけることができません。すべてを一歩進めて(master.xmlがfoo/master.xmlになるように)、問題を修正します。 – ishi
'$ {project.basedir}'を利用して、プロジェクトの名前をハードコーディングするのを避けることができます。 – Tunaki
「master.xml」と「baseline.xml」は同じディレクトリにありますか?どうやって 'sql'フォルダの場所ですか?あなたはディレクトリ構造を提供することができますか?ありがとう – Thracian