CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
0059_ai_standup.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.
| a686079 | 1 | -- AI Standup — daily + weekly Claude-generated team brief. |
| 2 | -- | |
| 3 | -- Two tables: | |
| 4 | -- `user_standup_prefs` — per-user opt-in flags (daily, weekly, email). | |
| 5 | -- Lives in its own table to avoid editing the | |
| 6 | -- locked `users` schema. Row is created lazily | |
| 7 | -- on first toggle. Fall-back: row missing == | |
| 8 | -- opted out. | |
| 9 | -- `ai_standups` — every generated standup. Used to render the | |
| 10 | -- /standups feed and to dedupe (one row per | |
| 11 | -- (user_id, scope, day) keeps the scheduler | |
| 12 | -- from firing twice on the same UTC day). | |
| 13 | -- | |
| 14 | -- Strictly additive — drop the two tables to remove the feature. | |
| 15 | ||
| 16 | CREATE TABLE IF NOT EXISTS "user_standup_prefs" ( | |
| 17 | "user_id" uuid PRIMARY KEY, | |
| 18 | "daily_enabled" boolean NOT NULL DEFAULT false, | |
| 19 | "weekly_enabled" boolean NOT NULL DEFAULT false, | |
| 20 | "email_enabled" boolean NOT NULL DEFAULT false, | |
| 21 | "hour_utc" integer NOT NULL DEFAULT 9, | |
| 22 | "last_daily_sent_at" timestamptz, | |
| 23 | "last_weekly_sent_at" timestamptz, | |
| 24 | "created_at" timestamptz NOT NULL DEFAULT now(), | |
| 25 | "updated_at" timestamptz NOT NULL DEFAULT now() | |
| 26 | ); | |
| 27 | ||
| 28 | --> statement-breakpoint | |
| 29 | ||
| 30 | CREATE TABLE IF NOT EXISTS "ai_standups" ( | |
| 31 | "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(), | |
| 32 | "user_id" uuid NOT NULL, | |
| 33 | "scope" text NOT NULL, | |
| 34 | "summary" text NOT NULL, | |
| 35 | "shipped_items" text NOT NULL DEFAULT '[]', | |
| 36 | "blocked_items" text NOT NULL DEFAULT '[]', | |
| 37 | "at_risk_items" text NOT NULL DEFAULT '[]', | |
| 38 | "window_start" timestamptz NOT NULL, | |
| 39 | "window_end" timestamptz NOT NULL, | |
| 40 | "ai_available" boolean NOT NULL DEFAULT false, | |
| 41 | "created_at" timestamptz NOT NULL DEFAULT now() | |
| 42 | ); | |
| 43 | ||
| 44 | --> statement-breakpoint | |
| 45 | ||
| 46 | CREATE INDEX IF NOT EXISTS "idx_ai_standups_user_created" | |
| 47 | ON "ai_standups" ("user_id", "created_at" DESC); | |
| 48 | ||
| 49 | --> statement-breakpoint | |
| 50 | ||
| 51 | CREATE INDEX IF NOT EXISTS "idx_ai_standups_user_scope_created" | |
| 52 | ON "ai_standups" ("user_id", "scope", "created_at" DESC); |