diff --git a/lib/db/src/schema/invoices.ts b/lib/db/src/schema/invoices.ts index 187848b..49d4474 100644 --- a/lib/db/src/schema/invoices.ts +++ b/lib/db/src/schema/invoices.ts @@ -1,13 +1,14 @@ import { pgTable, text, integer, boolean, timestamp } from "drizzle-orm/pg-core"; import { createInsertSchema } from "drizzle-zod"; import { z } from "zod/v4"; +import { jobs } from "./jobs"; export const INVOICE_TYPES = ["eval", "work"] as const; export type InvoiceType = (typeof INVOICE_TYPES)[number]; export const invoices = pgTable("invoices", { id: text("id").primaryKey(), - jobId: text("job_id").notNull(), + jobId: text("job_id").notNull().references(() => jobs.id), paymentHash: text("payment_hash").notNull().unique(), paymentRequest: text("payment_request").notNull(), amountSats: integer("amount_sats").notNull(),