Skip to content

Commit c7fce4d

Browse files
devakoneclaude
andcommitted
fix(db): rename reserved word 'window' to 'rollup_window' in community_rollups
SQL keyword 'window' caused migration failure on production. Also adds Community link to the top navigation for all users. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b5659ef commit c7fce4d

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

apps/web/src/app/AppHeader.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ export default function AppHeader(props: {
3535
? [
3636
{ href: "/", label: "My VCP" },
3737
{ href: "/vibes", label: "Repo VCPs" },
38+
{ href: "/community", label: "Community" },
3839
]
3940
: [
4041
{ href: "/", label: "Home" },
4142
{ href: "/methodology", label: "Methodology" },
4243
{ href: "/security", label: "Security" },
44+
{ href: "/community", label: "Community" },
4345
];
4446

4547
const links = props.isAdmin

apps/web/src/app/api/community/stats/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export async function GET() {
2626
const { data, error } = await supabase
2727
.from("community_rollups")
2828
.select("payload_json")
29-
.eq("window", "30d")
29+
.eq("rollup_window", "30d")
3030
.order("as_of_date", { ascending: false })
3131
.limit(1)
3232
.maybeSingle();

apps/web/src/inngest/functions/compute-community-rollup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const computeCommunityRollupFn = inngest.createFunction(
4747
const asOfDate = new Date().toISOString().split("T")[0];
4848

4949
const { error } = await supabase.from("community_rollups").insert({
50-
window: "30d",
50+
rollup_window: "30d",
5151
as_of_date: asOfDate,
5252
payload_json: payload,
5353
eligible_profiles: snapshots.length,

supabase/migrations/20260222000001_add_community_stats_tables.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ALTER TABLE public.community_profile_snapshots ENABLE ROW LEVEL SECURITY;
3434
--------------------------------------------------------------------------------
3535
CREATE TABLE IF NOT EXISTS public.community_rollups (
3636
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
37-
window TEXT NOT NULL,
37+
rollup_window TEXT NOT NULL,
3838
as_of_date DATE NOT NULL,
3939
payload_json JSONB NOT NULL,
4040
eligible_profiles INTEGER NOT NULL DEFAULT 0,
@@ -47,4 +47,4 @@ ALTER TABLE public.community_rollups ENABLE ROW LEVEL SECURITY;
4747

4848
-- Fast lookup: latest rollup by window type.
4949
CREATE INDEX idx_community_rollups_window_date
50-
ON public.community_rollups (window, as_of_date DESC);
50+
ON public.community_rollups (rollup_window, as_of_date DESC);

0 commit comments

Comments
 (0)