annotate OrthancServer/Sources/Database/InstallLabelsTable.sql @ 5553:28cc06e4859a large-queries

Added ExtendedApiV1: /changes
author Alain Mazy <am@orthanc.team>
date Thu, 11 Apr 2024 19:02:20 +0200
parents 48b8dae6dc77
children f7adfb22e20e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 -- Orthanc - A Lightweight, RESTful DICOM Store
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 -- Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 -- Department, University Hospital of Liege, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5256
diff changeset
4 -- Copyright (C) 2017-2024 Osimis S.A., Belgium
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5256
diff changeset
5 -- Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 --
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 -- This program is free software: you can redistribute it and/or
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 -- modify it under the terms of the GNU General Public License as
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 -- published by the Free Software Foundation, either version 3 of the
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 -- License, or (at your option) any later version.
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 --
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 -- This program is distributed in the hope that it will be useful, but
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 -- WITHOUT ANY WARRANTY; without even the implied warranty of
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 -- General Public License for more details.
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 --
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 -- You should have received a copy of the GNU General Public License
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 -- along with this program. If not, see <http://www.gnu.org/licenses/>.
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 CREATE TABLE Labels(
5256
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5227
diff changeset
22 id INTEGER REFERENCES Resources(internalId) ON DELETE CASCADE,
5227
988dab8deb1c "/tools/find" accepts the "WithLabels" and "WithoutLabels" arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
23 label TEXT NOT NULL,
5256
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5227
diff changeset
24 PRIMARY KEY(id, label) -- Prevents duplicates
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 );
5227
988dab8deb1c "/tools/find" accepts the "WithLabels" and "WithoutLabels" arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
26
5256
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5227
diff changeset
27 CREATE INDEX LabelsIndex1 ON Labels(id);
5227
988dab8deb1c "/tools/find" accepts the "WithLabels" and "WithoutLabels" arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
28 CREATE INDEX LabelsIndex2 ON Labels(label); -- This index allows efficient lookups