Skip to content

Latest commit

 

History

History
77 lines (57 loc) · 2.45 KB

File metadata and controls

77 lines (57 loc) · 2.45 KB
title Delete Flow and its Data
description Completely remove a flow and all its data during development
sidebar
order
55
next
link label
/deploy/
Operate

import { Aside, Code, CardGrid, LinkCard } from "@astrojs/starlight/components"; import deleteFlowFunctionCode from '@/../../core/supabase/tests/_shared/delete_flow_and_data.sql.raw?raw';

During development, you may want to completely remove a flow and all its data to make breaking changes, clean up test data, or start fresh after experimenting. This operation is destructive and should only be used in development environments.

This permanently deletes all flow data including: - All run history - All queued and archived messages - All task outputs - All flow definitions

Never use this in production. Use versioned flows instead (e.g., my_flow_v1, my_flow_v2) to safely deploy changes while maintaining complete flow history.

Using the Delete Function

The delete function accepts a flow slug parameter and removes all associated data:

pgflow.delete_flow_and_data(flow_slug TEXT)

Example usage in local development:

-- Delete a specific flow and all its data
SELECT pgflow.delete_flow_and_data('analyzeWebsite');

This deletes the flow definition, all runs, queued messages, and task outputs for the specified flow.

Installing the Function

This function is not included in default pgflow migrations to prevent accidental deployment to production. It has been thoroughly unit tested, but you must manually add it to your development database using the SQL in the [Delete Function](#the-delete-function) section below.

Install by running the SQL directly in your database using psql or Supabase Studio.

The Delete Function

Run this SQL to install the delete function:

After Deleting

Once you've deleted the flow:

  1. You can compile and deploy a fresh version without conflicts
  2. The flow slug becomes available for reuse
  3. All historical data is permanently lost

See Also