Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history

0074_claude_web_sessions.sql

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

0074_claude_web_sessions.sqlBlame56 lines · 1 contributor
90c7531Claude1-- Gluecron migration 0074: Claude-on-the-web sessions (Block CW).
2--
3-- Per-repo interactive Claude Code sessions runnable from any browser
4-- (including iPad). Each session owns:
5-- - A working directory on the gluecron web server (cloned from the
6-- repo's bare git store) where Claude can read + edit files.
7-- - A persistent transcript of user/assistant messages.
8-- - The Claude CLI session UUID so subsequent turns `--resume` it and
9-- keep full prior-turn context without us re-sending the transcript.
10--
11-- Admin-only in v1 (the route gates on isSiteAdmin). Customer-facing
12-- rollout will scope by owner_user_id and run in real containers — for
13-- v1 every session shares the web server's compute.
14--
15-- All DDL wrapped in DO blocks so partial replays are safe.
16
17--> statement-breakpoint
18DO $$
19BEGIN
20 CREATE TABLE IF NOT EXISTS "claude_web_sessions" (
21 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
22 "repository_id" uuid NOT NULL REFERENCES "repositories"("id") ON DELETE CASCADE,
23 "owner_user_id" uuid NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
24 "title" text NOT NULL DEFAULT 'New session',
25 "branch" text NOT NULL DEFAULT 'main',
26 "workdir_path" text NOT NULL,
27 "claude_session_id" text,
28 "status" text NOT NULL DEFAULT 'cold',
29 "last_active_at" timestamptz NOT NULL DEFAULT now(),
30 "created_at" timestamptz NOT NULL DEFAULT now()
31 );
32 CREATE INDEX IF NOT EXISTS "claude_web_sessions_repo_idx"
33 ON "claude_web_sessions"("repository_id", "last_active_at" DESC);
34 CREATE INDEX IF NOT EXISTS "claude_web_sessions_owner_idx"
35 ON "claude_web_sessions"("owner_user_id", "last_active_at" DESC);
36EXCEPTION WHEN OTHERS THEN
37 RAISE NOTICE 'claude_web_sessions create failed (%); feature will be unavailable', SQLERRM;
38END $$;
39
40--> statement-breakpoint
41DO $$
42BEGIN
43 CREATE TABLE IF NOT EXISTS "claude_web_messages" (
44 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
45 "session_id" uuid NOT NULL REFERENCES "claude_web_sessions"("id") ON DELETE CASCADE,
46 "role" text NOT NULL,
47 "body" text NOT NULL,
48 "exit_code" integer,
49 "duration_ms" integer,
50 "created_at" timestamptz NOT NULL DEFAULT now()
51 );
52 CREATE INDEX IF NOT EXISTS "claude_web_messages_session_idx"
53 ON "claude_web_messages"("session_id", "created_at");
54EXCEPTION WHEN OTHERS THEN
55 RAISE NOTICE 'claude_web_messages create failed (%);', SQLERRM;
56END $$;