import { defineRelations } from "drizzle-orm"; import * as schema from "./schema.ts"; export const relations = defineRelations(schema, (r) => ({ priceHistory: { sku: r.one.skus({ from: r.priceHistory.skuId, to: r.skus.skuId, }), }, skus: { card: r.one.cards({ from: [r.skus.productId, r.skus.variant], to: [r.cards.productId, r.cards.variant], }), history: r.many.priceHistory(), }, cards: { prices: r.many.skus(), set: r.one.sets({ from: r.cards.setId, to: r.sets.setId, }), tcgdata: r.one.tcgcards({ from: r.cards.productId, to: r.tcgcards.productId, }), }, sets: { cards: r.many.cards(), }, tcgcards: { cards: r.many.cards(), }, }));