annotate OrthancServer/Sources/Database/InstallLabelsTable.sql @ 5227:988dab8deb1c db-protobuf

"/tools/find" accepts the "WithLabels" and "WithoutLabels" arguments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Apr 2023 09:16:12 +0200
parents d0f7c742d397
children 261ce0ed85e6
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
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 -- Copyright (C) 2017-2023 Osimis S.A., Belgium
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 -- Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
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(
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 internalId 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,
988dab8deb1c "/tools/find" accepts the "WithLabels" and "WithoutLabels" arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
24 PRIMARY KEY(internalId, 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
988dab8deb1c "/tools/find" accepts the "WithLabels" and "WithoutLabels" arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
27 CREATE INDEX LabelsIndex1 ON Labels(internalId);
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