mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
liquibase upgrade (#993)
This commit is contained in:
@@ -57,7 +57,6 @@ import io.dropwizard.assets.AssetsBundle;
|
||||
import io.dropwizard.db.DataSourceFactory;
|
||||
import io.dropwizard.forms.MultiPartBundle;
|
||||
import io.dropwizard.hibernate.HibernateBundle;
|
||||
import io.dropwizard.migrations.MigrationsBundle;
|
||||
import io.dropwizard.server.DefaultServerFactory;
|
||||
import io.dropwizard.servlets.CacheBustingFilter;
|
||||
import io.dropwizard.setup.Bootstrap;
|
||||
@@ -97,13 +96,6 @@ 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 MultiPartBundle());
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class StartupService implements Managed {
|
||||
updateSchema();
|
||||
long count = UnitOfWork.call(sessionFactory, () -> userDAO.count());
|
||||
if (count == 0) {
|
||||
UnitOfWork.run(sessionFactory, () -> initialData());
|
||||
UnitOfWork.run(sessionFactory, this::initialData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,8 +63,9 @@ public class StartupService implements Managed {
|
||||
}
|
||||
|
||||
ResourceAccessor accessor = new ClassLoaderResourceAccessor(Thread.currentThread().getContextClassLoader());
|
||||
Liquibase liq = new Liquibase("migrations.xml", accessor, database);
|
||||
liq.update("prod");
|
||||
try (Liquibase liq = new Liquibase("migrations.xml", accessor, database)) {
|
||||
liq.update("prod");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
|
||||
Reference in New Issue
Block a user