annotate OrthancServer/Sources/Database/InstallLabelsTable.sql @ 5680:68fc5af30c03

added container class DatabaseConstraints
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Jul 2024 10:09:57 +0200
parents f7adfb22e20e
children
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
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
4 -- Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 -- Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5256
diff changeset
6 -- Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 --
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 -- 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
9 -- 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
10 -- 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
11 -- License, or (at your option) any later version.
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 --
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 -- 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
14 -- WITHOUT ANY WARRANTY; without even the implied warranty of
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 -- General Public License for more details.
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 --
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 -- 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
19 -- 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
20
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 CREATE TABLE Labels(
5256
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5227
diff changeset
23 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
24 label TEXT NOT NULL,
5256
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5227
diff changeset
25 PRIMARY KEY(id, label) -- Prevents duplicates
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 );
5227
988dab8deb1c "/tools/find" accepts the "WithLabels" and "WithoutLabels" arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
27
5256
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5227
diff changeset
28 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
29 CREATE INDEX LabelsIndex2 ON Labels(label); -- This index allows efficient lookups