liquibase upgrade (#993)

This commit is contained in:
Athou
2022-03-22 15:56:53 +01:00
parent 13a0516cce
commit 4b346dd2e1
3 changed files with 6 additions and 18 deletions

View File

@@ -309,15 +309,10 @@
<artifactId>dropwizard-hibernate</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-migrations</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.6.3</version>
<version>4.9.0</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
@@ -509,7 +504,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.22</version>
<version>8.0.28</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>

View File

@@ -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());
}

View File

@@ -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);