Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/libraries/workflow/USEFUL_QUERIES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Aggregate entire history

```sql
SELECT location, 'activity' AS t, activity_name AS name
FROM db_workflow.workflow_activity_events
WHERE
workflow_id = $1 AND NOT forgotten
UNION ALL
SELECT location, 'signal' AS t, signal_name AS name
FROM db_workflow.workflow_signal_events
WHERE
workflow_id = $1 AND NOT forgotten
UNION ALL
SELECT location, 'sub_workflow' AS t, sub_workflow_id::STRING AS name
FROM db_workflow.workflow_sub_workflow_events
WHERE
workflow_id = $1 AND NOT forgotten
UNION ALL
SELECT location, 'signal_send' AS t, signal_name AS name
FROM db_workflow.workflow_signal_send_events
WHERE
workflow_id = $1 AND NOT forgotten
UNION ALL
SELECT location, 'message_send' AS t, message_name AS name
FROM db_workflow.workflow_message_send_events
WHERE
workflow_id = $1 AND NOT forgotten
UNION ALL
SELECT location, 'loop' AS t, NULL AS name
FROM db_workflow.workflow_loop_events
WHERE
workflow_id = $1 AND NOT forgotten
ORDER BY location ASC;
```

> Remove `AND NOT forgotten` to show all events, including past loop executions
4 changes: 0 additions & 4 deletions lib/chirp-workflow/core/src/ctx/workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ pub struct WorkflowCtx {
conn: rivet_connection::Connection,

/// All events that have ever been recorded on this workflow.
///
/// If replaying, the workflow will check that the `ActivityId` is the same for all activities
/// to make sure the workflow hasn't diverged.
///
/// The reason this type is a hashmap is to allow querying by location.
event_history: Arc<HashMap<Location, Vec<Event>>>,
/// Input data passed to this workflow.
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/cluster/standalone/datacenter-tls-renew/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> {
"
UPDATE db_cluster.datacenter_tls
SET state2 = $3
FROM db_cluster.datacenter_tls
WHERE
state2 = $1 AND
expire_ts < $2
Expand Down