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

schema-deploys.ts

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

schema-deploys.tsBlame86 lines · 2 contributors
f764c07Claude1/**
9dd96b9Test User2 * Block N3 + R2 — Drizzle schema for the platform-deploy timeline.
f764c07Claude3 *
4 * Defined in a SEPARATE module because `src/db/schema.ts` is listed in
5 * §4 LOCKED BLOCKS of BUILD_BIBLE.md ("New tables only via new migration").
9dd96b9Test User6 * The matching migrations are
7 * - `drizzle/0046_platform_deploys.sql` (Block N3)
8 * - `drizzle/0053_deploy_steps.sql` (Block R2 — `last_step`, `step_count`,
9 * `platform_deploy_steps`)
f764c07Claude10 *
11 * Columns mirror the SQL migration 1:1 — keep in sync when superseded by a
12 * follow-up additive migration.
13 */
14
15import {
16 index,
17 integer,
18 pgTable,
19 text,
20 timestamp,
21 uuid,
22} from "drizzle-orm/pg-core";
23
24export const platformDeploys = pgTable(
25 "platform_deploys",
26 {
27 id: uuid("id").primaryKey().defaultRandom(),
28 runId: text("run_id").notNull().unique(),
29 sha: text("sha").notNull(),
30 source: text("source").notNull(),
31 // 'in_progress' | 'succeeded' | 'failed'
32 status: text("status").notNull().default("in_progress"),
33 startedAt: timestamp("started_at", { withTimezone: true })
34 .defaultNow()
35 .notNull(),
36 finishedAt: timestamp("finished_at", { withTimezone: true }),
37 durationMs: integer("duration_ms"),
38 error: text("error"),
39 createdAt: timestamp("created_at", { withTimezone: true })
40 .defaultNow()
41 .notNull(),
9dd96b9Test User42 // R2 — latest step the deploy reached + running count. Both populated by
43 // POST /api/events/deploy/step so a page refresh mid-deploy still shows
44 // the last known position even before SSE re-attaches.
45 lastStep: text("last_step"),
46 stepCount: integer("step_count").notNull().default(0),
f764c07Claude47 },
48 (table) => [index("idx_platform_deploys_started").on(table.startedAt)]
49);
50
51export type PlatformDeployRow = typeof platformDeploys.$inferSelect;
52export type NewPlatformDeployRow = typeof platformDeploys.$inferInsert;
9dd96b9Test User53
54// R2 — per-step audit trail. Optional surface; SSE is the live channel but
55// rows here let `/admin/deploys` reconstruct an in-progress deploy on
56// reload. The (deploy_id, step_name, status) tuple is uniquely indexed (see
57// migration 0053) so re-POSTing a step is a no-op.
58export const platformDeploySteps = pgTable(
59 "platform_deploy_steps",
60 {
61 id: uuid("id").primaryKey().defaultRandom(),
62 deployId: uuid("deploy_id").notNull(),
63 stepName: text("step_name").notNull(),
64 // 'in_progress' | 'succeeded' | 'failed'
65 status: text("status").notNull(),
66 startedAt: timestamp("started_at", { withTimezone: true })
67 .defaultNow()
68 .notNull(),
69 finishedAt: timestamp("finished_at", { withTimezone: true }),
70 durationMs: integer("duration_ms"),
71 output: text("output"),
72 createdAt: timestamp("created_at", { withTimezone: true })
73 .defaultNow()
74 .notNull(),
75 },
76 (table) => [
77 index("idx_platform_deploy_steps_deploy").on(
78 table.deployId,
79 table.startedAt
80 ),
81 ]
82);
83
84export type PlatformDeployStepRow = typeof platformDeploySteps.$inferSelect;
85export type NewPlatformDeployStepRow =
86 typeof platformDeploySteps.$inferInsert;