# HG changeset patch # User Alain Mazy # Date 1764336676 -3600 # Node ID a07d176a4b584d8cca53525d8838c0170075e366 # Parent 3327126233a63c50f2467acda878dcef68c9f646 renumbered revision 699 into 10 diff -r 3327126233a6 -r a07d176a4b58 PostgreSQL/CMakeLists.txt --- a/PostgreSQL/CMakeLists.txt Fri Nov 28 12:46:02 2025 +0100 +++ b/PostgreSQL/CMakeLists.txt Fri Nov 28 14:31:16 2025 +0100 @@ -96,7 +96,7 @@ POSTGRESQL_UPGRADE_REV3_TO_REV4 ${CMAKE_SOURCE_DIR}/Plugins/SQL/Upgrades/Rev3ToRev4.sql POSTGRESQL_UPGRADE_REV4_TO_REV5 ${CMAKE_SOURCE_DIR}/Plugins/SQL/Upgrades/Rev4ToRev5.sql POSTGRESQL_UPGRADE_REV5_TO_REV6 ${CMAKE_SOURCE_DIR}/Plugins/SQL/Upgrades/Rev5ToRev6.sql - POSTGRESQL_UPGRADE_REV6_TO_REV699 ${CMAKE_SOURCE_DIR}/Plugins/SQL/Upgrades/Rev6ToRev699.sql + POSTGRESQL_UPGRADE_REV6_TO_REV10 ${CMAKE_SOURCE_DIR}/Plugins/SQL/Upgrades/Rev6ToRev10.sql ) diff -r 3327126233a6 -r a07d176a4b58 PostgreSQL/NEWS --- a/PostgreSQL/NEWS Fri Nov 28 12:46:02 2025 +0100 +++ b/PostgreSQL/NEWS Fri Nov 28 14:31:16 2025 +0100 @@ -1,7 +1,7 @@ Pending changes in the mainline =============================== -DB schema revision: 6 +DB schema revision: 10 Minimum plugin SDK (for build): 1.12.5 Optimal plugin SDK (for build): 1.12.10 (TODO: update once released !) Minimum Orthanc runtime: 1.12.5 diff -r 3327126233a6 -r a07d176a4b58 PostgreSQL/Plugins/PostgreSQLIndex.cpp --- a/PostgreSQL/Plugins/PostgreSQLIndex.cpp Fri Nov 28 12:46:02 2025 +0100 +++ b/PostgreSQL/Plugins/PostgreSQLIndex.cpp Fri Nov 28 14:31:16 2025 +0100 @@ -49,7 +49,7 @@ static const GlobalProperty GlobalProperty_HasComputeStatisticsReadOnly = GlobalProperty_DatabaseInternal4; } -#define CURRENT_DB_REVISION 699 +#define CURRENT_DB_REVISION 10 namespace OrthancDatabases { @@ -270,15 +270,15 @@ if (currentRevision == 6) { - LOG(WARNING) << "Upgrading DB schema from revision 6 to revision 699"; + LOG(WARNING) << "Upgrading DB schema from revision 6 to revision 10 (there are no versions 7, 8 and 9 !)"; std::string query; Orthanc::EmbeddedResources::GetFileResource - (query, Orthanc::EmbeddedResources::POSTGRESQL_UPGRADE_REV6_TO_REV699); + (query, Orthanc::EmbeddedResources::POSTGRESQL_UPGRADE_REV6_TO_REV10); t.GetDatabaseTransaction().ExecuteMultiLines(query); hasAppliedAnUpgrade = true; - currentRevision = 699; + currentRevision = 10; } if (hasAppliedAnUpgrade) diff -r 3327126233a6 -r a07d176a4b58 PostgreSQL/Plugins/SQL/PrepareIndex.sql --- a/PostgreSQL/Plugins/SQL/PrepareIndex.sql Fri Nov 28 12:46:02 2025 +0100 +++ b/PostgreSQL/Plugins/SQL/PrepareIndex.sql Fri Nov 28 14:31:16 2025 +0100 @@ -400,7 +400,7 @@ -- These changes will be applied at regular interval by an external thread or when someone -- requests the statistics CREATE TABLE IF NOT EXISTS GlobalIntegersChanges( - pk BIGSERIAL PRIMARY KEY, -- new in rev699 required for pg_repack to be able to reclaim space + pk BIGSERIAL PRIMARY KEY, -- new in rev10 required for pg_repack to be able to reclaim space key INTEGER, value BIGINT); @@ -705,7 +705,7 @@ -- At regular interval, the DB housekeeping thread updates the childCount column of -- resources with an entry in this table. CREATE TABLE IF NOT EXISTS InvalidChildCounts( - pk BIGSERIAL PRIMARY KEY, -- new in rev699 required for pg_repack to be able to reclaim space + pk BIGSERIAL PRIMARY KEY, -- new in rev10 required for pg_repack to be able to reclaim space id BIGINT REFERENCES Resources(internalId) ON DELETE CASCADE, updatedAt TIMESTAMP DEFAULT NOW()); @@ -803,7 +803,7 @@ id BIGSERIAL NOT NULL PRIMARY KEY, queueId TEXT NOT NULL, value BYTEA NOT NULL, - reservedUntil BIGINT DEFAULT NULL -- new in rev 699 + reservedUntil BIGINT DEFAULT NULL -- new in rev 10 ); CREATE INDEX IF NOT EXISTS QueuesIndex ON Queues (queueId, id); @@ -857,7 +857,7 @@ -- set the global properties that actually documents the DB version, revision and some of the capabilities DELETE FROM GlobalProperties WHERE property IN (1, 4, 6, 10, 11, 12, 13, 14); INSERT INTO GlobalProperties VALUES (1, 6); -- GlobalProperty_DatabaseSchemaVersion -INSERT INTO GlobalProperties VALUES (4, 699); -- GlobalProperty_DatabasePatchLevel +INSERT INTO GlobalProperties VALUES (4, 10); -- GlobalProperty_DatabasePatchLevel INSERT INTO GlobalProperties VALUES (6, 1); -- GlobalProperty_GetTotalSizeIsFast INSERT INTO GlobalProperties VALUES (10, 1); -- GlobalProperty_HasTrigramIndex INSERT INTO GlobalProperties VALUES (11, 3); -- GlobalProperty_HasCreateInstance -- this is actually the 3rd version of HasCreateInstance diff -r 3327126233a6 -r a07d176a4b58 PostgreSQL/Plugins/SQL/Upgrades/Rev6ToRev10.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PostgreSQL/Plugins/SQL/Upgrades/Rev6ToRev10.sql Fri Nov 28 14:31:16 2025 +0100 @@ -0,0 +1,7 @@ +-- Adding a PK to these 2 table to allow pg_repack to process these tables, enabling reclaiming disk space and defragmenting the tables. + +ALTER TABLE InvalidChildCounts ADD COLUMN pk BIGSERIAL PRIMARY KEY; +ALTER TABLE GlobalIntegersChanges ADD COLUMN pk BIGSERIAL PRIMARY KEY; + +-- Adding the queues timeout +ALTER TABLE Queues ADD COLUMN reservedUntil BIGINT DEFAULT NULL; \ No newline at end of file diff -r 3327126233a6 -r a07d176a4b58 PostgreSQL/Plugins/SQL/Upgrades/Rev6ToRev699.sql --- a/PostgreSQL/Plugins/SQL/Upgrades/Rev6ToRev699.sql Fri Nov 28 12:46:02 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ --- Adding a PK to these 2 table to allow pg_repack to process these tables, enabling reclaiming disk space and defragmenting the tables. - -ALTER TABLE InvalidChildCounts ADD COLUMN pk BIGSERIAL PRIMARY KEY; -ALTER TABLE GlobalIntegersChanges ADD COLUMN pk BIGSERIAL PRIMARY KEY; - --- Adding the queues timeout -ALTER TABLE Queues ADD COLUMN reservedUntil BIGINT DEFAULT NULL; \ No newline at end of file