ec.gob.senescyt.sniese.commons.bundles.DBMigrationsBundle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sniese-commons Show documentation
Show all versions of sniese-commons Show documentation
Librería que contiene clases de uso comun para sniese hechos en dropwizard
package ec.gob.senescyt.sniese.commons.bundles;
import ec.gob.senescyt.sniese.commons.configurations.ConfiguracionSnieseBase;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.db.DataSourceFactory;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import org.flywaydb.core.Flyway;
public class DBMigrationsBundle implements ConfiguredBundle {
@Override
public void run(T configuration, Environment environment) {
Flyway flyway = new Flyway();
DataSourceFactory dataSourceFactory = configuration.getConfiguracionPersistente().getDatabase();
flyway.setDataSource(dataSourceFactory.getUrl(), dataSourceFactory.getUser(), dataSourceFactory.getPassword());
flyway.setSchemas(configuration.getConfiguracionPersistente().getDefaultSchema());
flyway.migrate();
}
@Override
public void initialize(Bootstrap> bootstrap) {
// Do nothing.
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy