comparison OrthancServer/PrepareDatabase.sql @ 1176:f24e04838054 db-changes

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Sep 2014 14:11:37 +0200
parents 8f9d49192815
children de1413733c97
comparison
equal deleted inserted replaced
1175:6fa65ccf312d 1176:f24e04838054
16 tagElement INTEGER, 16 tagElement INTEGER,
17 value TEXT, 17 value TEXT,
18 PRIMARY KEY(id, tagGroup, tagElement) 18 PRIMARY KEY(id, tagGroup, tagElement)
19 ); 19 );
20 20
21 -- The following table was added in Orthanc 0.8.4 (database v5) 21 -- The following table was added in Orthanc 0.8.5 (database v5)
22 CREATE TABLE DicomIdentifiers( 22 CREATE TABLE DicomIdentifiers(
23 id INTEGER REFERENCES Resources(internalId) ON DELETE CASCADE, 23 id INTEGER REFERENCES Resources(internalId) ON DELETE CASCADE,
24 tagGroup INTEGER, 24 tagGroup INTEGER,
25 tagElement INTEGER, 25 tagElement INTEGER,
26 value TEXT, 26 value TEXT,
75 CREATE INDEX PublicIndex ON Resources(publicId); 75 CREATE INDEX PublicIndex ON Resources(publicId);
76 CREATE INDEX ResourceTypeIndex ON Resources(resourceType); 76 CREATE INDEX ResourceTypeIndex ON Resources(resourceType);
77 CREATE INDEX PatientRecyclingIndex ON PatientRecyclingOrder(patientId); 77 CREATE INDEX PatientRecyclingIndex ON PatientRecyclingOrder(patientId);
78 78
79 CREATE INDEX MainDicomTagsIndex1 ON MainDicomTags(id); 79 CREATE INDEX MainDicomTagsIndex1 ON MainDicomTags(id);
80 -- The 2 following indexes were removed in Orthanc 0.8.4 (database v5), to speed up 80 -- The 2 following indexes were removed in Orthanc 0.8.5 (database v5), to speed up
81 -- CREATE INDEX MainDicomTagsIndex2 ON MainDicomTags(tagGroup, tagElement); 81 -- CREATE INDEX MainDicomTagsIndex2 ON MainDicomTags(tagGroup, tagElement);
82 -- CREATE INDEX MainDicomTagsIndexValues ON MainDicomTags(value COLLATE BINARY); 82 -- CREATE INDEX MainDicomTagsIndexValues ON MainDicomTags(value COLLATE BINARY);
83 83
84 -- The 3 following indexes were added in Orthanc 0.8.4 (database v5) 84 -- The 3 following indexes were added in Orthanc 0.8.5 (database v5)
85 CREATE INDEX DicomIdentifiersIndex1 ON DicomIdentifiers(id); 85 CREATE INDEX DicomIdentifiersIndex1 ON DicomIdentifiers(id);
86 CREATE INDEX DicomIdentifiersIndex2 ON DicomIdentifiers(tagGroup, tagElement); 86 CREATE INDEX DicomIdentifiersIndex2 ON DicomIdentifiers(tagGroup, tagElement);
87 CREATE INDEX DicomIdentifiersIndexValues ON DicomIdentifiers(value COLLATE BINARY); 87 CREATE INDEX DicomIdentifiersIndexValues ON DicomIdentifiers(value COLLATE BINARY);
88 88
89 CREATE INDEX ChangesIndex ON Changes(internalId); 89 CREATE INDEX ChangesIndex ON Changes(internalId);
98 END; 98 END;
99 99
100 CREATE TRIGGER ResourceDeleted 100 CREATE TRIGGER ResourceDeleted
101 AFTER DELETE ON Resources 101 AFTER DELETE ON Resources
102 BEGIN 102 BEGIN
103 SELECT SignalResourceDeleted(old.publicId, old.resourceType); -- New in Orthanc 0.8.4 (db v5) 103 SELECT SignalResourceDeleted(old.publicId, old.resourceType); -- New in Orthanc 0.8.5 (db v5)
104 SELECT SignalRemainingAncestor(parent.publicId, parent.resourceType) 104 SELECT SignalRemainingAncestor(parent.publicId, parent.resourceType)
105 FROM Resources AS parent WHERE internalId = old.parentId; 105 FROM Resources AS parent WHERE internalId = old.parentId;
106 END; 106 END;
107 107
108 -- Delete a parent resource when its unique child is deleted 108 -- Delete a parent resource when its unique child is deleted