annotate OrthancServer/Sources/Database/Upgrade3To4.sql @ 4044:d25f4c0fa160 framework

splitting code into OrthancFramework and OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 20:30:34 +0200
parents OrthancServer/Database/Upgrade3To4.sql@61da3c9b4121
children 28944db5318b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
694
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
1 -- This SQLite script updates the version of the Orthanc database from 3 to 4.
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
2
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
3 -- Add 2 new columns at "AttachedFiles"
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
4
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
5 ALTER TABLE AttachedFiles ADD COLUMN uncompressedMD5 TEXT;
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
6 ALTER TABLE AttachedFiles ADD COLUMN compressedMD5 TEXT;
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
7
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
8 -- Update the "AttachedFileDeleted" trigger
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
9
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
10 DROP TRIGGER AttachedFileDeleted;
693
01d8611c4a60 md5 for attached files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11
694
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
12 CREATE TRIGGER AttachedFileDeleted
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
13 AFTER DELETE ON AttachedFiles
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
14 BEGIN
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
15 SELECT SignalFileDeleted(old.uuid, old.fileType, old.uncompressedSize,
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
16 old.compressionType, old.compressedSize,
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
17 -- These 2 arguments are new in Orthanc 0.7.3 (database v4)
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
18 old.uncompressedMD5, old.compressedMD5);
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
19 END;
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
20
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
21 -- Change the database version
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
22 -- The "1" corresponds to the "GlobalProperty_DatabaseSchemaVersion" enumeration
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
23
72dc919a028c upgrade database from v3 to v4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 693
diff changeset
24 UPDATE GlobalProperties SET value="4" WHERE property=1;