use of org.jdbi.v3.jodatime2.JodaTimePlugin in project dropwizard by dropwizard.
the class JdbiFactory method configure.
/**
* Overridable function to allow extra customization of the created {@link Jdbi}
* instance.
*
* <p>
* If this is overridden it is strongly recommend that
* {@code super.configure(jdbi, configuration)} is invoked before any other
* changes are made if you intend to use the default as a base so that the
* customized settings will supersede the defaults
* </p>
*
* @param jdbi
*/
protected void configure(final Jdbi jdbi) {
jdbi.installPlugin(new SqlObjectPlugin());
jdbi.installPlugin(new JodaTimePlugin());
jdbi.installPlugin(new GuavaPlugin());
}
use of org.jdbi.v3.jodatime2.JodaTimePlugin in project nzyme by lennartkoopmann.
the class Database method initializeAndMigrate.
public void initializeAndMigrate() throws LiquibaseException {
this.jdbi = Jdbi.create("jdbc:" + configuration.databasePath()).installPlugin(new PostgresPlugin()).installPlugin(new JodaTimePlugin()).registerRowMapper(new MeasurementMapper()).registerRowMapper(new BeaconRateMapper()).registerRowMapper(new SignalIndexHistogramHistoryDBEntryMapper()).registerRowMapper(new AlertDatabaseEntryMapper()).registerRowMapper(new BanditMapper()).registerRowMapper(new BanditIdentifierMapper()).registerRowMapper(new ContactMapper()).registerRowMapper(new SentrySSIDMapper()).registerRowMapper(new DeauthenticationMonitorRecordingMapper()).registerRowMapper(new EventRecordMapper()).registerRowMapper(new ScheduledReportEntryMapper()).registerRowMapper(new ExecutionLogEntryMapper()).registerRowMapper(new ContactRecordMapper()).registerRowMapper(new ContactRecordValueAggregationMapper()).registerRowMapper(new ContactRecorderHistogramEntryMapper());
// Run migrations against underlying JDBC connection.
JdbcConnection connection = new JdbcConnection(jdbi.open().getConnection());
try {
liquibase.database.Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(connection);
Liquibase liquibase = new liquibase.Liquibase("db/migrations.xml", new ClassLoaderResourceAccessor(), database);
liquibase.update(new Contexts(), new LabelExpression());
} finally {
connection.close();
}
}
Aggregations