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

0087_pr_preview_builder.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.

0087_pr_preview_builder.sqlBlame35 lines · 1 contributor
1df50d5Claude1-- Migration 0077 — PR preview builder.
2--
3-- Adds per-repo preview build configuration to the repositories table.
4-- When preview_build_command is set, every PR push triggers a build (clone +
5-- run command + serve output). The resulting static files are served from
6-- /previews/:owner/:repo/:branch/* by the preview route handler.
7--
8-- Also creates pr_previews, a PR-scoped sibling to the existing branch_previews
9-- table (migration 0062). branch_previews tracks one row per branch (upserted on
10-- every push); pr_previews tracks one row per PR with richer build metadata
11-- (log, build time, command used) and a status that is updated after each build.
12
13-- ── Per-repo preview build config ──────────────────────────────────────────
14ALTER TABLE repositories ADD COLUMN IF NOT EXISTS preview_build_command text;
15ALTER TABLE repositories ADD COLUMN IF NOT EXISTS preview_output_dir text DEFAULT 'dist';
16
17-- ── pr_previews ─────────────────────────────────────────────────────────────
18CREATE TABLE IF NOT EXISTS pr_previews (
19 id serial PRIMARY KEY,
20 repo_id text NOT NULL REFERENCES repositories(id) ON DELETE CASCADE,
21 pr_id text NOT NULL REFERENCES pull_requests(id) ON DELETE CASCADE,
22 branch_name text NOT NULL,
23 head_sha text NOT NULL,
24 status text NOT NULL DEFAULT 'building', -- building | ready | failed
25 build_log text,
26 preview_url text,
27 build_command text,
28 output_dir text DEFAULT 'dist',
29 build_duration_ms integer,
30 created_at timestamp DEFAULT now(),
31 updated_at timestamp DEFAULT now()
32);
33
34CREATE INDEX IF NOT EXISTS pr_previews_pr_id_idx ON pr_previews(pr_id);
35CREATE INDEX IF NOT EXISTS pr_previews_repo_id_idx ON pr_previews(repo_id);