Skip to content
pgflow is in public beta. See project status for production readiness details.

# Update Deployed Flows

When updating flows that are already deployed to production, use the deprecation workflow to prevent old and new worker versions from processing tasks simultaneously.

First Time Deployment?

If you haven’t deployed to production yet, see Deploy Your First Flow for initial setup instructions.

## Update Workflow

Section titled “Update Workflow”

1. Deprecate old workers

       UPDATE pgflow.workersSET deprecated_at = NOW()WHERE function_name = 'your-worker-name'  AND deprecated_at IS NULL;

   This stops old workers from polling for new tasks while they finish current work.

2. Deploy new version

       npx supabase functions deploy your-worker-name

3. Start new worker

       curl "https://your-project.supabase.co/functions/v1/your-worker-name" \  -H "Authorization: Bearer YOUR_ANON_KEY"

4. Keep workers up

   Set up the pg_cron safety net for reliable production operation.

   Don't Skip the Safety Net

   Your workers will eventually stop working without a safety net. This is especially critical for production deployments where workflow reliability matters.

   The safety net takes 2 minutes to set up and prevents hours of debugging why workflows stopped running. Configure it now →

## Deployment Details

Section titled “Deployment Details”

### Why Worker Deprecation

Section titled “Why Worker Deprecation”

Without deprecation, old workers run for up to 150s (free tier) or 400s (paid) after deployment, causing both versions to process tasks simultaneously.

Deprecation fixes this: workers check their status every 5 seconds and immediately stop polling for new tasks when deprecated, while finishing current work.

### Getting Your ANON Key

Section titled “Getting Your ANON Key”

Find your ANON key in Supabase Dashboard → Settings → API → `anon` `public` key.

### Monitoring Workers

Section titled “Monitoring Workers”

Track deployment progress with this query:

    SELECT  function_name,  COUNT(*) FILTER (WHERE deprecated_at IS NULL) as active_workers,  COUNT(*) FILTER (WHERE deprecated_at IS NOT NULL) as deprecated_workersFROM pgflow.workersWHERE last_heartbeat_at > now() - interval '6 seconds'GROUP BY function_name;