Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fineract-provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ dependencyManagement {
dependency 'com.lowagie:itext:2.1.7'
dependency 'com.lowagie:itext-rtf:2.1.7'
dependency 'org.mnode.ical4j:ical4j:1.0.4'
dependency 'com.googlecode.flyway:flyway-core:2.1.1'
dependency 'org.flywaydb:flyway-core:+'
dependency 'org.quartz-scheduler:quartz:+'
dependency 'com.amazonaws:aws-java-sdk-s3:1.11.80'
dependency 'net.sf.ehcache:ehcache:+'
Expand Down
2 changes: 1 addition & 1 deletion fineract-provider/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ dependencies {
'com.lowagie:itext',
//'com.lowagie:itext-rtf',

'com.googlecode.flyway:flyway-core',
'org.flywaydb:flyway-core',

'com.amazonaws:aws-java-sdk-s3',
'net.sf.ehcache:ehcache',
Expand Down
2 changes: 1 addition & 1 deletion fineract-provider/dev-dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ dependencies {
'com.lowagie:itext',
'com.lowagie:itext-rtf',

'com.googlecode.flyway:flyway-core',
'org.flywaydb:flyway-core',

'com.amazonaws:aws-java-sdk-s3',
'net.sf.ehcache:ehcache',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

import com.google.common.collect.ImmutableMap;

import com.googlecode.flyway.core.Flyway;
import com.googlecode.flyway.core.api.FlywayException;
import com.googlecode.flyway.core.util.jdbc.DriverDataSource;
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.FlywayException;
import org.flywaydb.core.internal.jdbc.DriverDataSource;

/**
* A service that picks up on tenants that are configured to auto-update their
Expand Down Expand Up @@ -66,12 +66,18 @@ public void upgradeAllTenants() {
for (final FineractPlatformTenant tenant : tenants) {
final FineractPlatformTenantConnection connection = tenant.getConnection();
if (connection.isAutoUpdateEnabled()) {
final Flyway flyway = new Flyway();
String connectionProtocol = driverConfig.constructProtocol(connection.getSchemaServer(), connection.getSchemaServerPort(), connection.getSchemaName()) ;
DriverDataSource source = new DriverDataSource(driverConfig.getDriverClassName(), connectionProtocol, connection.getSchemaUsername(), connection.getSchemaPassword()) ;
flyway.setDataSource(source);
flyway.setLocations("sql/migrations/core_db");
flyway.setOutOfOrder(true);
String connectionProtocol = driverConfig.constructProtocol(connection.getSchemaServer(), connection.getSchemaServerPort(), connection.getSchemaName());
final Flyway flyway = Flyway
.configure()
.dataSource(connectionProtocol, connection.getSchemaUsername(), connection.getSchemaPassword())
.locations("sql/migrations/core_db")
.outOfOrder(true)
.load();

// DriverDataSource source = new DriverDataSource(driverConfig.getDriverClassName(), connectionProtocol, connection.getSchemaUsername(), connection.getSchemaPassword()) ;
// flyway.setDataSource(source);
// flyway.setLocations("sql/migrations/core_db");
// flyway.setOutOfOrder(true);
try {
flyway.migrate();
} catch (FlywayException e) {
Expand All @@ -88,13 +94,21 @@ public void upgradeAllTenants() {
* itself.
*/
private void upgradeTenantDB() {
final Flyway flyway = new Flyway();
flyway.setDataSource(tenantDataSource);
flyway.setLocations("sql/migrations/list_db");
flyway.setOutOfOrder(true);
flyway.setPlaceholders(ImmutableMap.of( // FINERACT-773
"fineract_default_tenantdb_hostname", System.getProperty("FINERACT_DEFAULT_TENANTDB_HOSTNAME", "localhost"),
"fineract_default_tenantdb_port", System.getProperty("FINERACT_DEFAULT_TENANTDB_PORT", "3306")));
final Flyway flyway = Flyway
.configure()
.dataSource(tenantDataSource)
.locations("sql/migrations/list_db")
.outOfOrder(true)
.placeholders(ImmutableMap.of( // FINERACT-773
"fineract_default_tenantdb_hostname", System.getProperty("FINERACT_DEFAULT_TENANTDB_HOSTNAME", "localhost"),
"fineract_default_tenantdb_port", System.getProperty("FINERACT_DEFAULT_TENANTDB_PORT", "3306")))
.load();
// flyway.setDataSource(tenantDataSource);
// flyway.setLocations("sql/migrations/list_db");
// flyway.setOutOfOrder(true);
// flyway.setPlaceholders(ImmutableMap.of( // FINERACT-773
// "fineract_default_tenantdb_hostname", System.getProperty("FINERACT_DEFAULT_TENANTDB_HOSTNAME", "localhost"),
// "fineract_default_tenantdb_port", System.getProperty("FINERACT_DEFAULT_TENANTDB_PORT", "3306")));
flyway.migrate();

tenantDataSourcePortFixService.fixUpTenantsSchemaServerPort();
Expand Down