annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1709
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 -- This SQLite script updates the version of the Orthanc database from 5 to 6.
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 -- Add a new table to enable full-text indexed search over studies
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 CREATE TABLE SearchableStudies(
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 id INTEGER REFERENCES Resources(internalId) ON DELETE CASCADE,
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 tagGroup INTEGER,
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 tagElement INTEGER,
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 value TEXT, -- assumed to be in upper case
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 PRIMARY KEY(id, tagGroup, tagElement)
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 );
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 CREATE INDEX SearchableStudiesIndex1 ON SearchableStudies(id);
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 CREATE INDEX SearchableStudiesIndexValues ON SearchableStudies(value COLLATE BINARY);
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 -- Change the database version
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 -- The "1" corresponds to the "GlobalProperty_DatabaseSchemaVersion" enumeration
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
2ad22b2970a2 SearchableStudies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 UPDATE GlobalProperties SET value="6" WHERE property=1;