Skip to main content

infra/sql/0004_event_pipeline.sql

Metadata

Indexed Symbols

No indexed functions/methods detected in this file.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

-- Event pipeline durability tables for telemetry ingest and routed actions.

create table if not exists telemetry_ingest_batches (
id uuid primary key default gen_random_uuid(),
workspace_id uuid not null,
correlation_id uuid not null,
event_count integer not null,
received_at timestamptz not null default now(),
payload jsonb not null
);

create table if not exists outbox_events (
id uuid primary key default gen_random_uuid(),
workspace_id uuid not null,
topic text not null,
correlation_id uuid not null,
payload jsonb not null,
status text not null default 'pending',
attempts integer not null default 0,
available_at timestamptz not null default now(),
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);

create index if not exists idx_outbox_events_status_available