forked from scalableminds/webknossos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path071-adapt-td-view-display-planes.sql
44 lines (37 loc) · 1.62 KB
/
071-adapt-td-view-display-planes.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
-- https://github.com/scalableminds/webknossos/pull/5440
START TRANSACTION;
-- Update tdViewDisplayPlanes user configuration setting based on its previous value
-- A previous tdViewDisplayPlanes value of true corresponds to the "DATA" enum value
-- and a value of false corresponds to the "WIREFRAME" enum value
-- For the user configuration
UPDATE webknossos.users
SET userconfiguration = CASE
WHEN jsonb_typeof(userconfiguration->'tdViewDisplayPlanes') = 'boolean' AND (userconfiguration->>'tdViewDisplayPlanes')::boolean IS TRUE THEN jsonb_set(
userconfiguration,
array['tdViewDisplayPlanes'],
to_jsonb('DATA'::text))
ELSE jsonb_set(
userconfiguration,
array['tdViewDisplayPlanes'],
to_jsonb('WIREFRAME'::text))
END
WHERE userconfiguration ? 'tdViewDisplayPlanes';
-- For the recommended configuration in task types
UPDATE webknossos.tasktypes
SET recommendedconfiguration = CASE
WHEN jsonb_typeof(recommendedconfiguration->'tdViewDisplayPlanes') = 'boolean' AND (recommendedconfiguration->>'tdViewDisplayPlanes')::boolean IS TRUE THEN jsonb_set(
recommendedconfiguration,
array['tdViewDisplayPlanes'],
to_jsonb('DATA'::text))
ELSE jsonb_set(
recommendedconfiguration,
array['tdViewDisplayPlanes'],
to_jsonb('WIREFRAME'::text))
END
WHERE recommendedconfiguration ? 'tdViewDisplayPlanes';
-- Remove unused configuration key of user configuration
UPDATE webknossos.users
SET userconfiguration = userconfiguration - 'configuration'
WHERE userconfiguration ? 'configuration';
UPDATE webknossos.releaseInformation SET schemaVersion = 71;
COMMIT TRANSACTION;