Fix update for alarms of removed tenants
This commit is contained in:
parent
3117af791c
commit
f0d9ba914d
@ -127,6 +127,8 @@ UPDATE resource
|
||||
|
||||
ALTER TABLE notification_request ALTER COLUMN info SET DATA TYPE varchar(1000000);
|
||||
|
||||
DELETE FROM alarm WHERE tenant_id NOT IN (SELECT id FROM tenant);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS alarm_types (
|
||||
tenant_id uuid NOT NULL,
|
||||
type varchar(255) NOT NULL,
|
||||
|
||||
@ -731,8 +731,8 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService
|
||||
break;
|
||||
case "3.5.1":
|
||||
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
|
||||
log.info("Updating schema ...");
|
||||
if (isOldSchema(conn, 3005001)) {
|
||||
log.info("Updating schema ...");
|
||||
schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "3.5.1", SCHEMA_UPDATE_SQL);
|
||||
loadSql(schemaUpdateFile, conn);
|
||||
|
||||
@ -762,8 +762,10 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService
|
||||
}
|
||||
|
||||
conn.createStatement().execute("UPDATE tb_schema_settings SET schema_version = 3005002;");
|
||||
log.info("Schema updated to version 3.5.2.");
|
||||
} else {
|
||||
log.info("Skip schema re-update to version 3.5.2. Use env flag 'SKIP_SCHEMA_VERSION_CHECK' to force the re-update.");
|
||||
}
|
||||
log.info("Schema updated.");
|
||||
} catch (Exception e) {
|
||||
log.error("Failed updating schema!!!", e);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user