diff OrthancServer/Upgrade5To6.sql @ 1709:2ad22b2970a2 db-changes

SearchableStudies
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Oct 2015 17:48:30 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancServer/Upgrade5To6.sql	Tue Oct 13 17:48:30 2015 +0200
@@ -0,0 +1,21 @@
+-- This SQLite script updates the version of the Orthanc database from 5 to 6.
+
+
+-- Add a new table to enable full-text indexed search over studies
+
+CREATE TABLE SearchableStudies(
+       id INTEGER REFERENCES Resources(internalId) ON DELETE CASCADE,
+       tagGroup INTEGER,
+       tagElement INTEGER,
+       value TEXT,  -- assumed to be in upper case
+       PRIMARY KEY(id, tagGroup, tagElement)
+       );
+
+CREATE INDEX SearchableStudiesIndex1 ON SearchableStudies(id);
+CREATE INDEX SearchableStudiesIndexValues ON SearchableStudies(value COLLATE BINARY);
+
+
+-- Change the database version
+-- The "1" corresponds to the "GlobalProperty_DatabaseSchemaVersion" enumeration
+
+UPDATE GlobalProperties SET value="6" WHERE property=1;