This repository was archived by the owner on Aug 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
src/main/resources/db/migration Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- See the NOTICE file distributed with this work for additional information
2
+ -- regarding copyright ownership.
3
+ --
4
+ -- Licensed under the Apache License, Version 2.0 (the "License");
5
+ -- you may not use this file except in compliance with the License.
6
+ -- You may obtain a copy of the License at
7
+ --
8
+ -- http://www.apache.org/licenses/LICENSE-2.0
9
+ --
10
+ -- Unless required by applicable law or agreed to in writing, software
11
+ -- distributed under the License is distributed on an "AS IS" BASIS,
12
+ -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ -- See the License for the specific language governing permissions and
14
+ -- limitations under the License.
15
+
16
+ -- Updates trial.additional_info to have a datasets array instead of just observationDatasetId.
17
+ -- Leaves observationDatasetId in place out of an abundance of caution.
18
+ -- Only updates rows that don't already have datasets key (just in case the code was updated prematurely).
19
+ DO
20
+ $$
21
+ BEGIN
22
+ UPDATE
23
+ trial
24
+ SET
25
+ additional_info = additional_info
26
+ || JSONB_BUILD_OBJECT(
27
+ ' datasets' ,
28
+ JSONB_BUILD_ARRAY(
29
+ JSONB_BUILD_OBJECT(
30
+ ' id' , additional_info- > ' observationDatasetId' ,
31
+ ' name' , additional_info- > ' defaultObservationLevel' ,
32
+ ' level' , ' 0'
33
+ )
34
+ )
35
+ )
36
+ WHERE
37
+ additional_info- > ' datasets' IS NULL ;
38
+ END
39
+ $$;
You can’t perform that action at this time.
0 commit comments