import {
index,
integer,
pgTable,
text,
timestamp,
uuid,
} from "drizzle-orm/pg-core";
export const platformDeploys = pgTable(
"platform_deploys",
{
id: uuid("id").primaryKey().defaultRandom(),
runId: text("run_id").notNull().unique(),
sha: text("sha").notNull(),
source: text("source").notNull(),
status: text("status").notNull().default("in_progress"),
startedAt: timestamp("started_at", { withTimezone: true })
.defaultNow()
.notNull(),
finishedAt: timestamp("finished_at", { withTimezone: true }),
durationMs: integer("duration_ms"),
error: text("error"),
createdAt: timestamp("created_at", { withTimezone: true })
.defaultNow()
.notNull(),
},
(table) => [index("idx_platform_deploys_started").on(table.startedAt)]
);
export type PlatformDeployRow = typeof platformDeploys.$inferSelect;
export type NewPlatformDeployRow = typeof platformDeploys.$inferInsert;
|