[chore] schema for price history

This commit is contained in:
2026-03-09 15:43:37 -04:00
parent 3d46a48a7d
commit f03c909745
2 changed files with 16 additions and 0 deletions

View File

@@ -2,11 +2,18 @@ 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(),