- apps/captain-mobile: Mobile API service - apps/flow-ui: Flow UI application - apps/mindlink: Mindlink application - apps/storage: Storage API and workers - apps/tzzr-cli: TZZR CLI tool - deck-frontend/backups: Historical TypeScript versions - hst-frontend: Standalone HST frontend Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
43 lines
1.5 KiB
SQL
43 lines
1.5 KiB
SQL
-- Captain Claude Mobile - PostgreSQL Schema
|
|
-- Database: captain_mobile
|
|
|
|
-- Create user and database if not exists (run as postgres superuser)
|
|
-- CREATE USER captain WITH PASSWORD 'captain';
|
|
-- CREATE DATABASE captain_mobile OWNER captain;
|
|
-- GRANT ALL PRIVILEGES ON DATABASE captain_mobile TO captain;
|
|
|
|
-- Tables for conversation history
|
|
CREATE TABLE IF NOT EXISTS conversations (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
user_id VARCHAR(255) NOT NULL,
|
|
title VARCHAR(500),
|
|
created_at TIMESTAMP DEFAULT NOW(),
|
|
updated_at TIMESTAMP DEFAULT NOW()
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS messages (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
conversation_id UUID REFERENCES conversations(id) ON DELETE CASCADE,
|
|
role VARCHAR(50) NOT NULL, -- 'user' or 'assistant'
|
|
content TEXT NOT NULL,
|
|
created_at TIMESTAMP DEFAULT NOW()
|
|
);
|
|
|
|
-- Indexes
|
|
CREATE INDEX IF NOT EXISTS idx_messages_conversation ON messages(conversation_id);
|
|
CREATE INDEX IF NOT EXISTS idx_conversations_user ON conversations(user_id);
|
|
CREATE INDEX IF NOT EXISTS idx_conversations_updated ON conversations(updated_at DESC);
|
|
|
|
-- File attachments tracking (optional)
|
|
CREATE TABLE IF NOT EXISTS attachments (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
message_id UUID REFERENCES messages(id) ON DELETE CASCADE,
|
|
filename VARCHAR(500) NOT NULL,
|
|
file_path VARCHAR(1000) NOT NULL,
|
|
mime_type VARCHAR(100),
|
|
size_bytes BIGINT,
|
|
created_at TIMESTAMP DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_attachments_message ON attachments(message_id);
|