# HG changeset patch # User Alain Mazy # Date 1707153997 -3600 # Node ID 11c6bcc9d1f2ceaf2d2c83bd6ceb4f9b5d870232 # Parent 302f3c2b1c34f74d126fc575ffc8e40092caf559 cleanup diff -r 302f3c2b1c34 -r 11c6bcc9d1f2 Framework/Plugins/IDatabaseBackend.h --- a/Framework/Plugins/IDatabaseBackend.h Mon Feb 05 09:48:11 2024 +0100 +++ b/Framework/Plugins/IDatabaseBackend.h Mon Feb 05 18:26:37 2024 +0100 @@ -349,19 +349,19 @@ virtual void ListAllLabels(std::list& target, DatabaseManager& manager) = 0; - // New in Orthanc 1.12.X + // New in Orthanc 1.12.3 virtual bool HasAtomicIncrementGlobalProperty() = 0; - // New in Orthanc 1.12.X + // New in Orthanc 1.12.3 virtual int64_t IncrementGlobalProperty(DatabaseManager& manager, const char* serverIdentifier, int32_t property, int64_t increment) = 0; - // New in Orthanc 1.12.X + // New in Orthanc 1.12.3 virtual bool HasUpdateAndGetStatistics() = 0; - // New in Orthanc 1.12.X + // New in Orthanc 1.12.3 virtual void UpdateAndGetStatistics(DatabaseManager& manager, int64_t& patientsCount, int64_t& studiesCount, @@ -370,10 +370,10 @@ int64_t& compressedSize, int64_t& uncompressedSize) = 0; - // New in Orthanc 1.12.X + // New in Orthanc 1.12.3 virtual bool HasMeasureLatency() = 0; - // New in Orthanc 1.12.X + // New in Orthanc 1.12.3 virtual uint64_t MeasureLatency(DatabaseManager& manager) = 0; diff -r 302f3c2b1c34 -r 11c6bcc9d1f2 Framework/PostgreSQL/PostgreSQLParameters.h --- a/Framework/PostgreSQL/PostgreSQLParameters.h Mon Feb 05 09:48:11 2024 +0100 +++ b/Framework/PostgreSQL/PostgreSQLParameters.h Mon Feb 05 18:26:37 2024 +0100 @@ -32,9 +32,8 @@ { enum IsolationMode { - IsolationMode_DbDefault = 0, - IsolationMode_Serializable = 1, - IsolationMode_ReadCommited = 2 + IsolationMode_Serializable = 0, + IsolationMode_ReadCommited = 1 }; class PostgreSQLParameters @@ -142,8 +141,6 @@ { switch (isolationMode_) { - case IsolationMode_DbDefault: - return ""; case IsolationMode_ReadCommited: return "SET TRANSACTION ISOLATION LEVEL READ COMMITTED READ WRITE"; case IsolationMode_Serializable: @@ -157,8 +154,6 @@ { switch (isolationMode_) { - case IsolationMode_DbDefault: - return ""; case IsolationMode_ReadCommited: return "SET TRANSACTION ISOLATION LEVEL READ COMMITTED READ ONLY"; case IsolationMode_Serializable: diff -r 302f3c2b1c34 -r 11c6bcc9d1f2 PostgreSQL/Plugins/SQL/Downgrades/Rev2ToRev1.sql --- a/PostgreSQL/Plugins/SQL/Downgrades/Rev2ToRev1.sql Mon Feb 05 09:48:11 2024 +0100 +++ b/PostgreSQL/Plugins/SQL/Downgrades/Rev2ToRev1.sql Mon Feb 05 18:26:37 2024 +0100 @@ -1,14 +1,14 @@ --- This file contains an SQL procedure to downgrade from schema 6.2 to 6.1 (version = 6, revision = 1). --- It reinstalls all triggers and temporary tables that have been removed or replaced in 6.2 +-- This file contains an SQL procedure to downgrade from schema Rev2 to Rev1 (version = 6, revision = 1). +-- It reinstalls all triggers and temporary tables that have been removed or replaced in Rev2 -- note: we don't not remove the unique constraints that have been added - they should not -- create any issues. --- these constraints were introduced in 6.2 +-- these constraints were introduced in Rev2 ALTER TABLE Resources DROP CONSTRAINT UniquePublicId; ALTER TABLE PatientRecyclingOrder DROP CONSTRAINT UniquePatientId; --- the CreateInstance has been replaced in 6.2, reinstall the 6.1 +-- the CreateInstance has been replaced in Rev2, reinstall the Rev1 DROP FUNCTION CreateInstance; CREATE FUNCTION CreateInstance( IN patient TEXT, @@ -108,7 +108,7 @@ $body$ LANGUAGE plpgsql; --- these tables have been deleted in 6.2: +-- these tables have been deleted in Rev2: CREATE TABLE DeletedFiles( uuid VARCHAR(64) NOT NULL, -- 0 fileType INTEGER, -- 1 @@ -130,13 +130,13 @@ ); --- these triggers have been introduced in 6.2, remove them +-- these triggers have been introduced in Rev2, remove them DROP TRIGGER IF EXISTS IncrementResourcesTracker on Resources; DROP TRIGGER IF EXISTS DecrementResourcesTracker on Resources; DROP FUNCTION IF EXISTS IncrementResourcesTrackerFunc; DROP FUNCTION IF EXISTS DecrementResourcesTrackerFunc; --- this trigger has been removed in 6.2, reinstall it +-- this trigger has been removed in Rev2, reinstall it CREATE OR REPLACE FUNCTION CountResourcesTrackerFunc() RETURNS TRIGGER AS $$ BEGIN @@ -155,7 +155,7 @@ FOR EACH ROW EXECUTE PROCEDURE CountResourcesTrackerFunc(); --- this trigger was introduced in 6.2, remove it: +-- this trigger was introduced in Rev2, remove it: DROP FUNCTION IF EXISTS InsertOrUpdateMetadata; -- reinstall old triggers: @@ -189,14 +189,14 @@ FOR EACH ROW EXECUTE PROCEDURE AttachedFileDecrementSizeFunc(); --- these functions have been introduced in 6.2: +-- these functions have been introduced in Rev2: DROP FUNCTION IF EXISTS UpdateStatistics; DROP FUNCTION IF EXISTS UpdateSingleStatistic; --- this table has been introduced in 6.2: +-- this table has been introduced in Rev2: DROP TABLE IF EXISTS GlobalIntegersChanges; --- these functions have been introduced in 6.2: +-- these functions have been introduced in Rev2: DROP FUNCTION IF EXISTS CreateDeletedFilesTemporaryTable; DROP FUNCTION IF EXISTS DeleteResource; diff -r 302f3c2b1c34 -r 11c6bcc9d1f2 PostgreSQL/Plugins/SQL/PrepareIndex.sql --- a/PostgreSQL/Plugins/SQL/PrepareIndex.sql Mon Feb 05 09:48:11 2024 +0100 +++ b/PostgreSQL/Plugins/SQL/PrepareIndex.sql Mon Feb 05 18:26:37 2024 +0100 @@ -1,4 +1,4 @@ --- This SQL file creates a DB in version.revision 6.2 directly +-- This SQL file creates a DB in Rev2 directly -- It is also run after upgrade scripts to create new tables and or create/replace triggers and functions. -- This script is self contained, it contains everything that needs to be run to create an Orthanc DB. -- Note to developers: diff -r 302f3c2b1c34 -r 11c6bcc9d1f2 PostgreSQL/Plugins/SQL/Upgrades/Rev1ToRev2.sql --- a/PostgreSQL/Plugins/SQL/Upgrades/Rev1ToRev2.sql Mon Feb 05 09:48:11 2024 +0100 +++ b/PostgreSQL/Plugins/SQL/Upgrades/Rev1ToRev2.sql Mon Feb 05 18:26:37 2024 +0100 @@ -1,4 +1,4 @@ --- This file contains part of the changes required to upgrade from 6.1 to 6.2 (DB version 6 and revision 2) +-- This file contains part of the changes required to upgrade from Revision 1 to Revision 2 (DB version 6 and revision 1 or 2) -- It actually contains only the changes that: -- can not be executed with an idempotent statement in SQL -- or would polute the PrepareIndex.sql @@ -35,13 +35,13 @@ END $body$ LANGUAGE plpgsql; --- In V6.2, we'll now use temporary tables so we need to remove the old tables that might have been used in previous revisions ! +-- In Rev2, we'll now use temporary tables so we need to remove the old tables that might have been used in previous revisions ! -- these statements, although idempotent, are not part of PrepareIndexV2.sql to keep it clean DROP TABLE IF EXISTS DeletedFiles; DROP TABLE IF EXISTS RemainingAncestor; DROP TABLE IF EXISTS DeletedResources; --- These triggers disappears and are not replaced in V6.2 +-- These triggers disappears and are not replaced in Rev2 DROP TRIGGER IF EXISTS CountResourcesTracker ON Resources; -- The signature has changed so we must delete the function before replacing it. diff -r 302f3c2b1c34 -r 11c6bcc9d1f2 Resources/Orthanc/Sdk-1.12.3/orthanc/OrthancDatabasePlugin.proto --- a/Resources/Orthanc/Sdk-1.12.3/orthanc/OrthancDatabasePlugin.proto Mon Feb 05 09:48:11 2024 +0100 +++ b/Resources/Orthanc/Sdk-1.12.3/orthanc/OrthancDatabasePlugin.proto Mon Feb 05 18:26:37 2024 +0100 @@ -121,7 +121,7 @@ OPERATION_START_TRANSACTION = 4; OPERATION_UPGRADE = 5; OPERATION_FINALIZE_TRANSACTION = 6; - OPERATION_MEASURE_LATENCY = 7; // New in Orthanc 1.12.X + OPERATION_MEASURE_LATENCY = 7; // New in Orthanc 1.12.3 } enum TransactionType { @@ -290,8 +290,8 @@ OPERATION_ADD_LABEL = 45; // New in Orthanc 1.12.0 OPERATION_REMOVE_LABEL = 46; // New in Orthanc 1.12.0 OPERATION_LIST_LABELS = 47; // New in Orthanc 1.12.0 - OPERATION_INCREMENT_GLOBAL_PROPERTY = 48; // New in Orthanc 1.12.X - OPERATION_UPDATE_AND_GET_STATISTICS = 49; // New in Orthanc 1.12.X + OPERATION_INCREMENT_GLOBAL_PROPERTY = 48; // New in Orthanc 1.12.3 + OPERATION_UPDATE_AND_GET_STATISTICS = 49; // New in Orthanc 1.12.3 } message Rollback {