Skip to content

Commit

Permalink
Create required workflow context
Browse files Browse the repository at this point in the history
Initially, the workflow context record did not seem all that important,
but as turns out during further testing, it should contain 'is_transaction' = 1.
  • Loading branch information
ehuelsmann committed Dec 3, 2023
1 parent 48d5886 commit 3b1eab6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sql/changes/1.11/workflow-for-aa-transactions.sql
Expand Up @@ -15,6 +15,15 @@ new_workflow AS (
now() as last_update
FROM aa_transactions
RETURNING workflow_id, state, last_update
),
new_context AS (
INSERT INTO workflow_context
SELECT workflow_id, jsonb_build_object( 'is_transaction', 1,
'transdate', transdate,
'table_name', table_name)
FROM new_workflow
JOIN aa_transactions USING (workflow_id)
RETURNING workflow_id
)
INSERT INTO workflow_history
SELECT nextval('workflow_History_seq') as workflow_hist_id,
Expand All @@ -24,4 +33,4 @@ SELECT nextval('workflow_History_seq') as workflow_hist_id,
state,
'<upgrade>' as workflow_user,
last_update as history_date
FROM new_workflow;
FROM new_context JOIN new_workflow USING (workflow_id);

0 comments on commit 3b1eab6

Please sign in to comment.