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

0053_deploy_steps.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.

0053_deploy_steps.sqlBlame57 lines · 1 contributor
9dd96b9Test User1-- Block R2 — Live deploy log streaming.
2--
3-- Extends Block N3's `platform_deploys` timeline with per-step state so the
4-- /admin/deploys modal can show "git pull → bun install → build → restart →
5-- smoke test" in real time via SSE.
6--
7-- Strictly additive (drop the new column + table to remove). N3's table is
8-- listed in BUILD_BIBLE.md §4.6 as locked; we add columns + a sibling child
9-- table without renaming or repurposing any existing columns.
10--
11-- Wire contract:
12-- POST /api/events/deploy/step
13-- Authorization: Bearer ${DEPLOY_EVENT_TOKEN}
14-- Body: {
15-- run_id, sha, step_name,
16-- status: "in_progress" | "succeeded" | "failed",
17-- output?, duration_ms?
18-- }
19--
20-- Idempotency is on (deploy_id, step_name, status) — replaying the same
21-- transition is a no-op. The endpoint also publishes an SSE event on
22-- topic = `platform:deploys:<run_id>`
23-- which the modal subscribes to via /live-events/:topic.
24
25ALTER TABLE platform_deploys
26 ADD COLUMN IF NOT EXISTS last_step text,
27 ADD COLUMN IF NOT EXISTS step_count integer NOT NULL DEFAULT 0;
28
29--> statement-breakpoint
30
31-- Per-step audit trail. Optional; we publish via SSE for live consumption
32-- but persist a record so refreshing the page during a deploy still shows
33-- the latest known state.
34CREATE TABLE IF NOT EXISTS platform_deploy_steps (
35 id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
36 deploy_id uuid NOT NULL REFERENCES platform_deploys(id) ON DELETE CASCADE,
37 step_name text NOT NULL,
38 status text NOT NULL, -- in_progress | succeeded | failed
39 started_at timestamptz NOT NULL DEFAULT now(),
40 finished_at timestamptz,
41 duration_ms integer,
42 output text, -- stdout/stderr first 8KB
43 created_at timestamptz NOT NULL DEFAULT now()
44);
45
46--> statement-breakpoint
47
48CREATE INDEX IF NOT EXISTS idx_platform_deploy_steps_deploy
49 ON platform_deploy_steps (deploy_id, started_at);
50
51--> statement-breakpoint
52
53-- Idempotency key — POSTing the same (deploy_id, step_name, status) twice
54-- short-circuits at the application layer (defensive); the partial index
55-- makes the dedupe path index-only.
56CREATE UNIQUE INDEX IF NOT EXISTS uniq_platform_deploy_steps_transition
57 ON platform_deploy_steps (deploy_id, step_name, status);