diff 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
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/InstallLabelsTable.sql	Tue Apr 04 07:09:22 2023 +0200
+++ b/OrthancServer/Sources/Database/InstallLabelsTable.sql	Tue Apr 04 09:16:12 2023 +0200
@@ -20,5 +20,9 @@
 
 CREATE TABLE Labels(
        internalId INTEGER REFERENCES Resources(internalId) ON DELETE CASCADE,
-       label TEXT
+       label TEXT NOT NULL,
+       PRIMARY KEY(internalId, label)  -- Prevents duplicates
        );
+
+CREATE INDEX LabelsIndex1 ON Labels(internalId);
+CREATE INDEX LabelsIndex2 ON Labels(label);  -- This index allows efficient lookups