Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

add xspace-agent/packages/core/src/db/migrations/0002_webhooks.sql

overstepping6694d4fcc307
diff --git a/xspace-agent/packages/core/src/db/migrations/0002_webhooks.sql b/xspace-agent/packages/core/src/db/migrations/0002_webhooks.sql
new file mode 100644
index 000000000..5a333d912
--- /dev/null
+++ b/xspace-agent/packages/core/src/db/migrations/0002_webhooks.sql
@@ -0,0 +1,42 @@
+-- Migration: 0002_webhooks
+-- Description: Create webhook and webhook delivery tables
+-- Created: 2026-03-23
+
+-- Webhooks
+CREATE TABLE IF NOT EXISTS webhooks (
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
+ org_id UUID REFERENCES organizations(id) ON DELETE CASCADE,
+ url TEXT NOT NULL,
+ secret TEXT NOT NULL,
+ events TEXT[] NOT NULL,
+ active TEXT NOT NULL DEFAULT 'true',
+ description TEXT,
+ headers JSONB DEFAULT '{}',
+ failure_count INTEGER DEFAULT 0,
+ created_at TIMESTAMPTZ DEFAULT NOW(),
+ updated_at TIMESTAMPTZ DEFAULT NOW()
+);
+
+-- Webhook Deliveries
+CREATE TABLE IF NOT EXISTS webhook_deliveries (
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
+ webhook_id UUID REFERENCES webhooks(id) ON DELETE CASCADE,
+ event_type TEXT NOT NULL,
+ payload JSONB NOT NULL,
+ status TEXT NOT NULL DEFAULT 'pending',
+ attempts INTEGER DEFAULT 0,
+ last_attempt_at TIMESTAMPTZ,
+ next_retry_at TIMESTAMPTZ,
+ response_status INTEGER,
+ response_body TEXT,
+ duration_ms INTEGER,
+ created_at TIMESTAMPTZ DEFAULT NOW()
+);
+
+-- Indexes
+CREATE INDEX IF NOT EXISTS idx_webhooks_org ON webhooks(org_id);
+CREATE INDEX IF NOT EXISTS idx_webhooks_org_active ON webhooks(org_id, active);
+CREATE INDEX IF NOT EXISTS idx_webhook_deliveries_webhook ON webhook_deliveries(webhook_id);
+CREATE INDEX IF NOT EXISTS idx_webhook_deliveries_status ON webhook_deliveries(status, next_retry_at);
+
+