私はスプリングブートとliquibaseで概念証明アプリケーションを実行しようとしています。私は基本的にコンテキストと呼ばれるチェンジセット属性を利用してliquibaseチェンジセットを管理できるスプリングブートアプリケーションを作成したいのですが、コンテキストを持たないチェンジセットは任意のスプリングブートプロファイルに適用できますが、特定のコンテキスト(context = "dev"など)そのタイプのスプリングブートプロファイルがアクティブな場合にのみ適用されます(例:spring.profiles.active = dev)。changsetスコープを管理するためにliquibase changesetコンテキスト属性を持つスプリングブートプロファイルを使用する
私のアプリでは、私は次の春プロファイルを持っています - > dev、prod(プロファイルの下に指定されたrelavantプロファイルdb資格を持つアプリケーションyamlファイルで正しく指定されています)。この仕事をするためには何が必要ですか?以下の私のapplication.yaml
spring:
application:
name: liquibase-spring-jpa-postgres-example
liquibase:
change-log: db.changelog/db.changelog-master.xml
spring:
profiles: dev
datasource:
url: jdbc:postgresql://localhost:5432/dev
username: postgres
password: password
driver-class-name: org.postgresql.Driver
spring:
profiles: ci
datasource:
url: jdbc:postgresql://localhost:5432/ci
username: postgres
password: password
driver-class-name: org.postgresql.Driver
spring:
profiles: qa
datasource:
url: jdbc:postgresql://localhost:5432/qa
username: postgres
password: password
driver-class-name: org.postgresql.Driver
spring:
profiles: production
datasource:
url: jdbc:postgresql://localhost:5432/prod
username: postgres
password: password
driver-class-name: org.postgresql.Driver
であり、以下に現在のdatabaseChangeLogファイルである(私の春のプロファイルがPRODである場合に、第2の変更セットは実行しないでください)。
<changeSet id="20161016_my_first_change" author="fike" context="dev, qa, ci, production">
<sql>
CREATE TABLE customer
(
id BIGSERIAL PRIMARY KEY,
firstname character varying NOT NULL,
lastname character varying NOT NULL
);
</sql>
<rollback>
drop table customer;
</rollback>
</changeSet>
<changeSet id="20161016_my_first_change2" author="krudland" context="dev">
<sql>
insert into customer (firstname, lastname) values ('Franklin','Ike');
</sql>
<rollback>
delete from customer where firstname = 'Franklin' and lastname = 'Ike';
</rollback>
</changeSet>
私は基本的に私の春のプロファイルを使用して、私のLiquiBaseをコンテキストを管理できるようにする必要があります。これは可能ですか?