-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject.sql
More file actions
116 lines (107 loc) · 3.59 KB
/
project.sql
File metadata and controls
116 lines (107 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
-- Relay project schema (reference)
-- Use this file for schema reference. Run against Neon Postgres when Phase 5+ is reached.
-- Users (Phase 5+)
-- CREATE TABLE users (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- email TEXT NOT NULL UNIQUE,
-- name TEXT,
-- google_refresh_token_encrypted TEXT,
-- created_at TIMESTAMPTZ DEFAULT NOW()
-- );
-- Sessions
-- CREATE TABLE sessions (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- user_id UUID REFERENCES users(id),
-- started_at TIMESTAMPTZ DEFAULT NOW(),
-- briefing_snapshot JSONB,
-- created_at TIMESTAMPTZ DEFAULT NOW()
-- );
-- Pending actions
-- CREATE TABLE pending_actions (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- session_id UUID REFERENCES sessions(id),
-- type TEXT CHECK (type IN ('draft_email', 'create_event', 'follow_up')),
-- payload JSONB,
-- status TEXT CHECK (status IN ('pending', 'approved', 'rejected')),
-- created_at TIMESTAMPTZ DEFAULT NOW()
-- );
-- Action executions / audit events (audit/trust layer). G2/G3: provider, external IDs, failure detail, rejected review outcomes.
-- CREATE TABLE action_executions (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- pending_action_id UUID REFERENCES pending_actions(id),
-- user_id UUID REFERENCES users(id),
-- action_id TEXT NOT NULL,
-- type TEXT NOT NULL,
-- title TEXT,
-- proposed_payload JSONB NOT NULL,
-- executed_at TIMESTAMPTZ NOT NULL,
-- execution_status TEXT CHECK (execution_status IN ('success', 'failed', 'rejected')),
-- error_message TEXT,
-- user_email TEXT,
-- source TEXT CHECK (source IN ('live', 'mock')),
-- created_at TIMESTAMPTZ DEFAULT NOW()
-- );
-- Selected Drive files (G2). Picker-selected file IDs per user; file-based store used until DB.
-- CREATE TABLE selected_drive_files (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- user_id UUID REFERENCES users(id),
-- file_id TEXT NOT NULL,
-- name TEXT,
-- mime_type TEXT,
-- web_view_link TEXT,
-- last_synced_at TIMESTAMPTZ DEFAULT NOW()
-- );
-- Meeting attendances
-- CREATE TABLE meeting_attendances (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- session_id UUID REFERENCES sessions(id),
-- event_id TEXT,
-- transcript_snapshot TEXT,
-- relay_update_text TEXT,
-- voice_audio_url TEXT,
-- created_at TIMESTAMPTZ DEFAULT NOW()
-- );
-- Briefings
-- CREATE TABLE briefings (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- session_id UUID REFERENCES sessions(id),
-- inbox_summary JSONB,
-- calendar_summary JSONB,
-- priorities JSONB,
-- created_at TIMESTAMPTZ DEFAULT NOW()
-- );
-- User profiles (Phase 4.5+)
-- CREATE TABLE user_profiles (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- user_id UUID REFERENCES users(id) UNIQUE,
-- display_name TEXT,
-- role TEXT,
-- timezone TEXT,
-- communication_style TEXT,
-- preferred_tone TEXT,
-- audience_tones JSONB,
-- autonomy_mode TEXT,
-- auto_approve_rules JSONB,
-- protected_actions JSONB,
-- work_hours JSONB,
-- focus_windows JSONB,
-- meeting_update_style TEXT,
-- voice_enabled BOOLEAN,
-- voice_provider TEXT,
-- voice_id TEXT,
-- voice_consent_status TEXT,
-- style_memory JSONB,
-- onboarding_completed_at TIMESTAMPTZ,
-- created_at TIMESTAMPTZ DEFAULT NOW(),
-- updated_at TIMESTAMPTZ DEFAULT NOW()
-- );
-- Style learnings
-- CREATE TABLE style_learnings (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- user_id UUID REFERENCES users(id),
-- original_text TEXT,
-- edited_text TEXT,
-- context TEXT,
-- extracted_preference JSONB,
-- created_at TIMESTAMPTZ DEFAULT NOW()
-- );