-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathFlywayConfig.java
More file actions
51 lines (39 loc) · 1.72 KB
/
Copy pathFlywayConfig.java
File metadata and controls
51 lines (39 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.db.piramalswasthya.config;
import javax.sql.DataSource;
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.configuration.FluentConfiguration;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FlywayConfig {
@Value("${amrit.flyway.ignore-applied-migration-checksum:false}")
private boolean ignoreAppliedMigrationChecksum;
private Flyway createFlyway(DataSource dataSource, String location) {
FluentConfiguration configuration = Flyway.configure()
.dataSource(dataSource)
.locations(location)
.baselineOnMigrate(true);
if (ignoreAppliedMigrationChecksum) {
configuration.ignoreMigrationPatterns("*:applied");
}
return configuration.load();
}
@Bean
public Flyway flywayDbiemr(@Qualifier("dbiemrDataSource") DataSource dataSource) {
return createFlyway(dataSource, "classpath:db/migration/dbiemr");
}
@Bean
public Flyway flywayDbidentity(@Qualifier("dbidentityDataSource") DataSource dataSource) {
return createFlyway(dataSource, "classpath:db/migration/dbidentity");
}
@Bean
public Flyway flywayDbreporting(@Qualifier("dbreportingDataSource") DataSource dataSource) {
return createFlyway(dataSource, "classpath:db/migration/dbreporting");
}
@Bean
public Flyway flywayDb1097identity(@Qualifier("db1097identityDataSource") DataSource dataSource) {
return createFlyway(dataSource, "classpath:db/migration/db1097identity");
}
}