#!/bin/bash # n8n-activate.sh # This script manually flips the 'active' bit in the n8n SQLite database. DB_PATH="/data/.n8n/database.sqlite" if [ ! -f "$DB_PATH" ]; then echo "Error: Database not found at $DB_PATH" exit 1 fi echo "Surgically activating all production workflows..." # Set all workflows with 'PRODUCTION' in the name to active sqlite3 "$DB_PATH" "UPDATE workflow_entity SET active = 1 WHERE name LIKE '%PRODUCTION%';" # Also ensure the webhook_entity table is populated for the handler # We use a subquery to get the ID of the handler WORKFLOW_ID=$(sqlite3 "$DB_PATH" "SELECT id FROM workflow_entity WHERE name = 'Stripe Webhook Handler - PRODUCTION' LIMIT 1;") if [ -n "$WORKFLOW_ID" ]; then echo "Registering webhook route for $WORKFLOW_ID..." sqlite3 "$DB_PATH" "INSERT OR REPLACE INTO webhook_entity (workflowId, webhookPath, method, node, webhookId, pathLength) VALUES ('$WORKFLOW_ID', 'stripe-webhook', 'POST', 'webhook-node', 'stripe-webhook', 15);" else echo "Error: Stripe Webhook Handler not found in database." fi echo "Activation complete. Restarting n8n for routing refresh..."