29 lines
848 B
TypeScript
29 lines
848 B
TypeScript
import {
|
|
integer,
|
|
jsonb,
|
|
pgTable,
|
|
text,
|
|
timestamp,
|
|
uuid,
|
|
} from "drizzle-orm/pg-core";
|
|
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
|
import type { z } from "zod";
|
|
|
|
export const jobAuditLog = pgTable("job_audit_log", {
|
|
id: uuid("id").defaultRandom().primaryKey(),
|
|
jobName: text("job_name"),
|
|
startedAt: timestamp("start_at"),
|
|
finishedAt: timestamp("finished_at"),
|
|
durationMs: integer("duration_ms"),
|
|
status: text("status"), //success | error
|
|
errorMessage: text("error_message"),
|
|
errorStack: text("error_stack"),
|
|
metadata: jsonb("meta_data"),
|
|
});
|
|
|
|
export const jobAuditLogSchema = createSelectSchema(jobAuditLog);
|
|
export const newJobAuditLogSchema = createInsertSchema(jobAuditLog);
|
|
|
|
export type JobAuditLog = z.infer<typeof jobAuditLogSchema>;
|
|
export type NewJobAuditLog = z.infer<typeof newJobAuditLogSchema>;
|