|
|
@ -94,7 +94,7 @@ public class PsqlTsDatabaseUpgradeService extends AbstractSqlTsDatabaseUpgradeSe |
|
|
log.info("PostgreSQL version is valid!"); |
|
|
log.info("PostgreSQL version is valid!"); |
|
|
if (isOldSchema(conn, 2004003)) { |
|
|
if (isOldSchema(conn, 2004003)) { |
|
|
log.info("Load upgrade functions ..."); |
|
|
log.info("Load upgrade functions ..."); |
|
|
loadSql(conn, LOAD_FUNCTIONS_SQL); |
|
|
loadSql(conn, LOAD_FUNCTIONS_SQL, "2.4.3"); |
|
|
log.info("Updating timeseries schema ..."); |
|
|
log.info("Updating timeseries schema ..."); |
|
|
executeQuery(conn, CALL_CREATE_PARTITION_TS_KV_TABLE); |
|
|
executeQuery(conn, CALL_CREATE_PARTITION_TS_KV_TABLE); |
|
|
if (!partitionType.equals("INDEFINITE")) { |
|
|
if (!partitionType.equals("INDEFINITE")) { |
|
|
@ -179,9 +179,9 @@ public class PsqlTsDatabaseUpgradeService extends AbstractSqlTsDatabaseUpgradeSe |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
log.info("Load TTL functions ..."); |
|
|
log.info("Load TTL functions ..."); |
|
|
loadSql(conn, LOAD_TTL_FUNCTIONS_SQL); |
|
|
loadSql(conn, LOAD_TTL_FUNCTIONS_SQL, "2.4.3"); |
|
|
log.info("Load Drop Partitions functions ..."); |
|
|
log.info("Load Drop Partitions functions ..."); |
|
|
loadSql(conn, LOAD_DROP_PARTITIONS_FUNCTIONS_SQL); |
|
|
loadSql(conn, LOAD_DROP_PARTITIONS_FUNCTIONS_SQL, "2.4.3"); |
|
|
|
|
|
|
|
|
executeQuery(conn, "UPDATE tb_schema_settings SET schema_version = 2005000"); |
|
|
executeQuery(conn, "UPDATE tb_schema_settings SET schema_version = 2005000"); |
|
|
|
|
|
|
|
|
@ -199,9 +199,9 @@ public class PsqlTsDatabaseUpgradeService extends AbstractSqlTsDatabaseUpgradeSe |
|
|
case "3.2.1": |
|
|
case "3.2.1": |
|
|
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) { |
|
|
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) { |
|
|
log.info("Load TTL functions ..."); |
|
|
log.info("Load TTL functions ..."); |
|
|
loadSql(conn, LOAD_TTL_FUNCTIONS_SQL); |
|
|
loadSql(conn, LOAD_TTL_FUNCTIONS_SQL, "2.4.3"); |
|
|
log.info("Load Drop Partitions functions ..."); |
|
|
log.info("Load Drop Partitions functions ..."); |
|
|
loadSql(conn, LOAD_DROP_PARTITIONS_FUNCTIONS_SQL); |
|
|
loadSql(conn, LOAD_DROP_PARTITIONS_FUNCTIONS_SQL, "2.4.3"); |
|
|
|
|
|
|
|
|
executeQuery(conn, "DROP PROCEDURE IF EXISTS cleanup_timeseries_by_ttl(character varying, bigint, bigint);"); |
|
|
executeQuery(conn, "DROP PROCEDURE IF EXISTS cleanup_timeseries_by_ttl(character varying, bigint, bigint);"); |
|
|
executeQuery(conn, "DROP FUNCTION IF EXISTS delete_asset_records_from_ts_kv(character varying, character varying, bigint);"); |
|
|
executeQuery(conn, "DROP FUNCTION IF EXISTS delete_asset_records_from_ts_kv(character varying, character varying, bigint);"); |
|
|
@ -244,8 +244,8 @@ public class PsqlTsDatabaseUpgradeService extends AbstractSqlTsDatabaseUpgradeSe |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void loadSql(Connection conn, String fileName) { |
|
|
protected void loadSql(Connection conn, String fileName, String version) { |
|
|
Path schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "2.4.3", fileName); |
|
|
Path schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", version, fileName); |
|
|
try { |
|
|
try { |
|
|
loadFunctions(schemaUpdateFile, conn); |
|
|
loadFunctions(schemaUpdateFile, conn); |
|
|
log.info("Functions successfully loaded!"); |
|
|
log.info("Functions successfully loaded!"); |
|
|
|