0013_deploy_history.sql19 lines · main
1-- deploy_history — one row per api boot, written from src/index.ts after
2-- migrations succeed. Drives the admin "Deploys" widget and is the audit
3-- trail behind /info.buildSha. See apps/api/src/db/schema.ts for the
4-- field-level reasoning.
5
6CREATE TABLE IF NOT EXISTS "deploy_history" (
7 "id" text PRIMARY KEY NOT NULL,
8 "service" text NOT NULL,
9 "build_sha" text NOT NULL,
10 "build_at" text,
11 "env" text NOT NULL,
12 "booted_at" timestamp with time zone DEFAULT now() NOT NULL
13);
14
15CREATE INDEX IF NOT EXISTS "deploy_history_service_booted_idx"
16 ON "deploy_history" USING btree ("service", "booted_at");
17
18CREATE INDEX IF NOT EXISTS "deploy_history_build_sha_idx"
19 ON "deploy_history" USING btree ("build_sha");