Перейти к основному содержимому

Schema Overview

PostgreSQL schema reference for the Crawbl orchestrator. All tables live in the orchestrator schema, set via search_path on the database connection.

Entity Hierarchy

users
+-- user_preferences (1:1, CASCADE delete)
+-- user_push_tokens (1:1, CASCADE delete)
+-- workspaces (1:N, CASCADE delete)
+-- agents (1:N, CASCADE delete)
+-- conversations (1:N, CASCADE delete)
+-- messages (1:N, CASCADE delete)

Entity Relationship Diagram

Database Schema
Click diagram to zoom

Tables

TableRows per parentDelete behaviorDescription
usersSoft delete (deleted_at)User accounts
user_preferences1 per userCASCADETheme, language, currency
user_push_tokens1 per userCASCADEFCM push token
workspacesN per userCASCADEIsolated work environments
agentsN per workspaceCASCADEAI agents within a workspace
conversationsN per workspaceCASCADEChat threads (swarm or agent)
messagesN per conversationCASCADEIndividual messages

Conventions

ConventionDetail
Primary keysUUIDs generated in Go, not database-generated
TimestampsAll tables have created_at and updated_at (TIMESTAMPTZ)
Soft deletesdeleted_at column (only users currently)
Foreign keysON DELETE CASCADE by default
Agent referencesON DELETE SET NULL (conversations and messages keep the row when an agent is removed)
Schemaorchestrator, set via search_path on the connection