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