Skip to content

Commit

Permalink
Stop writing flowrun.path
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Dec 4, 2024
1 parent 26b6703 commit dce3b12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
11 changes: 4 additions & 7 deletions core/models/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type FlowRun struct {
ExitedOn *time.Time `db:"exited_on"`
Responded bool `db:"responded"`
Results string `db:"results"`
Path string `db:"path"`
PathNodes pq.StringArray `db:"path_nodes"`
PathTimes pq.GenericArray `db:"path_times"`
CurrentNodeUUID null.String `db:"current_node_uuid"`
Expand Down Expand Up @@ -102,7 +101,6 @@ func newRun(ctx context.Context, tx *sqlx.Tx, oa *OrgAssets, session *Session, f
OrgID: oa.OrgID(),
SessionID: session.ID(),
StartID: NilStartID,
Path: string(jsonx.MustMarshal(path)),
PathNodes: pathNodes,
PathTimes: pq.GenericArray{A: pathTimes},
Results: string(jsonx.MustMarshal(fr.Results())),
Expand All @@ -127,9 +125,9 @@ func newRun(ctx context.Context, tx *sqlx.Tx, oa *OrgAssets, session *Session, f

const sqlInsertRun = `
INSERT INTO
flows_flowrun(uuid, created_on, modified_on, exited_on, status, responded, results, path, path_nodes, path_times,
flows_flowrun(uuid, created_on, modified_on, exited_on, status, responded, results, path_nodes, path_times,
current_node_uuid, contact_id, flow_id, org_id, session_id, start_id)
VALUES(:uuid, :created_on, NOW(), :exited_on, :status, :responded, :results, :path, :path_nodes, :path_times,
VALUES(:uuid, :created_on, NOW(), :exited_on, :status, :responded, :results, :path_nodes, :path_times,
:current_node_uuid, :contact_id, :flow_id, :org_id, :session_id, :start_id)
RETURNING id
`
Expand All @@ -149,15 +147,14 @@ SET
exited_on = r.exited_on::timestamptz,
responded = r.responded::bool,
results = r.results,
path = r.path::jsonb,
path_nodes = r.path_nodes::uuid[],
path_times = r.path_times::timestamptz[],
current_node_uuid = r.current_node_uuid::uuid,
modified_on = NOW()
FROM (
VALUES(:uuid, :status, :exited_on, :responded, :results, :path, :path_nodes, :path_times, :current_node_uuid)
VALUES(:uuid, :status, :exited_on, :responded, :results, :path_nodes, :path_times, :current_node_uuid)
) AS
r(uuid, status, exited_on, responded, results, path, path_nodes, path_times, current_node_uuid)
r(uuid, status, exited_on, responded, results, path_nodes, path_times, current_node_uuid)
WHERE
fr.uuid = r.uuid::uuid`

Expand Down
1 change: 0 additions & 1 deletion core/models/runs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func TestInsertAndUpdateRuns(t *testing.T) {
ModifiedOn: t2,
Responded: true,
Results: `{}`,
Path: `[]`,
PathNodes: []string{"1895cae0-d3c0-4470-83df-0b4cf9449438", "3ea3c026-e1c0-4950-bb94-d4c532b1459f"},
PathTimes: pq.GenericArray{A: []interface{}{t1, t2}},
CurrentNodeUUID: "5f0d8d24-0178-4b10-ae35-b3ccdc785777",
Expand Down

0 comments on commit dce3b12

Please sign in to comment.