Open semik opened 8 months ago
It should start without the permission to create database schema. Looking into the code I think this is a bug:
try (Connection conn = dataSource.getConnection();
Statement statement = conn.createStatement()) {
logger.info("Going to create DB schema '{}' if not exists.", schemaName);
statement.execute("create schema if not exists " + schemaName);
} catch (SQLException e) {
throw new RuntimeException("Failed to create schema '" + schemaName + "'", e);
}
There is an unhandled exception when the user does not have permission to create schema.
It should be fixed.
We should switch to Flyway migration tool also in Scheduler
microservice
Describe the bug CZERTAINLY-Scheduler fails to start when database user does not have permission to create schema.
To Reproduce
Steps to reproduce the behavior:
helm uninstall czertainly-tlm
REVOKE CREATE ON DATABASE czertainlydb FROM czertainlyuser;
helm upgrade --namespace czertainly -i --reset-values --values=.../czertainly-values.local.yaml --set keycloakInternal.image.tag=develop-latest --wait --timeout 30m czertainly-tlm czertainly-2.11.0.tg
scheduler-service-deployment--xxx
fails to start (except of core, which has dependency on this)Schema was existing:
Logs of the failed container:
Expected behavior I've got impression that CZERTAINLY should be able to start even when it has no permissions to create schema.