comparison OrthancServer/Sources/Database/Upgrade6To7.sql @ 5080:d7274e43ea7c attach-custom-data

allow plugins to store a customData in the Attachments table to e.g. store custom paths without requiring an external DB
author Alain Mazy <am@osimis.io>
date Thu, 08 Sep 2022 17:42:08 +0200
parents
children
comparison
equal deleted inserted replaced
5079:4366b4c41441 5080:d7274e43ea7c
1 -- Orthanc - A Lightweight, RESTful DICOM Store
2 -- Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
3 -- Department, University Hospital of Liege, Belgium
4 -- Copyright (C) 2017-2022 Osimis S.A., Belgium
5 -- Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
6 --
7 -- This program is free software: you can redistribute it and/or
8 -- modify it under the terms of the GNU General Public License as
9 -- published by the Free Software Foundation, either version 3 of the
10 -- License, or (at your option) any later version.
11 --
12 -- This program is distributed in the hope that it will be useful, but
13 -- WITHOUT ANY WARRANTY; without even the implied warranty of
14 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 -- General Public License for more details.
16 --
17 -- You should have received a copy of the GNU General Public License
18 -- along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20
21 --
22 -- This SQLite script updates the version of the Orthanc database from 6 to 7.
23 --
24
25 -- Add a new column to AttachedFiles
26
27 ALTER TABLE AttachedFiles ADD COLUMN customData TEXT;
28
29 -- update the triggers
30 DROP TRIGGER AttachedFileDeleted;
31
32 CREATE TRIGGER AttachedFileDeleted
33 AFTER DELETE ON AttachedFiles
34 BEGIN
35 SELECT SignalFileDeleted(old.uuid, old.fileType, old.uncompressedSize,
36 old.compressionType, old.compressedSize,
37 -- These 2 arguments are new in Orthanc 0.7.3 (database v4)
38 old.uncompressedMD5, old.compressedMD5,
39 -- Next argument new in Orthanc 1.12.0 (database v7)
40 old.customData);
41 END;
42
43 -- Change the database version
44 -- The "1" corresponds to the "GlobalProperty_DatabaseSchemaVersion" enumeration
45
46 UPDATE GlobalProperties SET value="7" WHERE property=1;