infra/sql/0006_security_hardening.sql
Metadata
- Purpose: SQL migration or seed data script for persistent storage.
- Domain:
infrastructure - Language:
sql - Bytes: 3821
- Lines: 146
- Content hash (short):
b10d52a3 - Source (start): infra/sql/0006_security_hardening.sql:1
- Source (end): infra/sql/0006_security_hardening.sql:146
Indexed Symbols
No indexed functions/methods detected in this file.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
-- Security and integrity hardening for workflow/event pipeline tables.
create table if not exists webhook_receipts (
provider text not null,
delivery_id text not null,
received_at timestamptz not null default now(),
primary key (provider, delivery_id)
);
create index if not exists idx_webhook_receipts_received_at
on webhook_receipts(received_at desc);
alter table audit_credentials
add column if not exists correlation_id uuid,
add column if not exists algorithm text,
add column if not exists key_id text;
update audit_credentials ac
set correlation_id = we.correlation_id
from workflow_executions we
where ac.execution_id = we.id
and ac.correlation_id is null;
create index if not exists idx_audit_credentials_workspace_correlation
on audit_credentials(workspace_id, correlation_id);