changeset 768:a07d176a4b58 pg-next-699

renumbered revision 699 into 10
author Alain Mazy <am@orthanc.team>
date Fri, 28 Nov 2025 14:31:16 +0100
parents 3327126233a6
children 5c6ee778aa4c
files PostgreSQL/CMakeLists.txt PostgreSQL/NEWS PostgreSQL/Plugins/PostgreSQLIndex.cpp PostgreSQL/Plugins/SQL/PrepareIndex.sql PostgreSQL/Plugins/SQL/Upgrades/Rev6ToRev10.sql PostgreSQL/Plugins/SQL/Upgrades/Rev6ToRev699.sql
diffstat 6 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- 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
   )
 
 
--- 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
--- 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)
--- 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
--- /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
--- 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