File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- +migrate Up
2
+ CREATE VIEW view_node_run_job AS
3
+ SELECT
4
+ jobs- >> ' id' as " id" ,
5
+ jobs- >> ' workflow_node_run_id' as " workflow_node_run_id" ,
6
+ jobs- >> ' status' as " status" ,
7
+ cast(jobs- >> ' start' as timestamp with time zone ) as " started" ,
8
+ cast(jobs- >> ' queued' as timestamp with time zone ) as " queued" ,
9
+ cast(jobs- >> ' done' as timestamp with time zone ) as " done" ,
10
+ jobs- >> ' retry' as " retry" ,
11
+ jobs- >> ' model' as " model" ,
12
+ jobs- >> ' worker_name' as " worker" ,
13
+ jobs- >> ' hatchery_name' as " hatchery"
14
+ FROM (
15
+ SELECT
16
+ jsonb_array_elements(
17
+ CASE jsonb_typeof(stages- > ' run_jobs' )
18
+ WHEN ' array' THEN stages- > ' run_jobs'
19
+ ELSE ' []' END
20
+ ) jobs
21
+ FROM (
22
+ SELECT
23
+ jsonb_array_elements(
24
+ CASE jsonb_typeof(stages)
25
+ WHEN ' array' THEN stages
26
+ ELSE ' []' END
27
+ ) stages
28
+ FROM workflow_node_run
29
+ ) tmpStages
30
+ ) tmpJobs
31
+ order by started desc ;
32
+
33
+ -- +migrate Down
34
+ DROP VIEW view_node_run_job;
You can’t perform that action at this time.
0 commit comments