re-add dropwizard-migrations to be able to use liquibase from command line

This commit is contained in:
Athou
2022-11-15 10:48:51 +01:00
parent fa58b1e53f
commit e44ea5bc96
3 changed files with 15 additions and 11 deletions

View File

@@ -261,8 +261,8 @@
<artifactId>dropwizard-hibernate</artifactId> <artifactId>dropwizard-hibernate</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.liquibase</groupId> <groupId>io.dropwizard</groupId>
<artifactId>liquibase-core</artifactId> <artifactId>dropwizard-migrations</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.dropwizard</groupId> <groupId>io.dropwizard</groupId>

View File

@@ -57,6 +57,7 @@ import io.dropwizard.assets.AssetsBundle;
import io.dropwizard.db.DataSourceFactory; import io.dropwizard.db.DataSourceFactory;
import io.dropwizard.forms.MultiPartBundle; import io.dropwizard.forms.MultiPartBundle;
import io.dropwizard.hibernate.HibernateBundle; import io.dropwizard.hibernate.HibernateBundle;
import io.dropwizard.migrations.MigrationsBundle;
import io.dropwizard.server.DefaultServerFactory; import io.dropwizard.server.DefaultServerFactory;
import io.dropwizard.servlets.CacheBustingFilter; import io.dropwizard.servlets.CacheBustingFilter;
import io.dropwizard.setup.Bootstrap; import io.dropwizard.setup.Bootstrap;
@@ -107,6 +108,13 @@ public class CommaFeedApplication extends Application<CommaFeedConfiguration> {
} }
}); });
bootstrap.addBundle(new MigrationsBundle<CommaFeedConfiguration>() {
@Override
public DataSourceFactory getDataSourceFactory(CommaFeedConfiguration configuration) {
return configuration.getDataSourceFactory();
}
});
bootstrap.addBundle(new AssetsBundle("/assets/", "/", "index.html")); bootstrap.addBundle(new AssetsBundle("/assets/", "/", "index.html"));
bootstrap.addBundle(new MultiPartBundle()); bootstrap.addBundle(new MultiPartBundle());
} }

View File

@@ -45,18 +45,14 @@ public class CommaFeedConfiguration extends Configuration {
@JsonProperty("app") @JsonProperty("app")
private ApplicationSettings applicationSettings; private ApplicationSettings applicationSettings;
private final ResourceBundle bundle; private final String version;
private final String gitCommit;
public CommaFeedConfiguration() { public CommaFeedConfiguration() {
bundle = ResourceBundle.getBundle("application"); ResourceBundle bundle = ResourceBundle.getBundle("application");
}
public String getVersion() { this.version = bundle.getString("version");
return bundle.getString("version"); this.gitCommit = bundle.getString("git.commit");
}
public String getGitCommit() {
return bundle.getString("git.commit");
} }
@Getter @Getter