export const userRelation = relations(users, ({ one, many }) => ({
...
payment_history: many(payment_history),
...
}))
export const paymentHistoryRelations = relations(payment_history, ({ one, many }) => ({
...
last_payment: one(users, {
fields: [payment_history.user_id],
references: [users.last_payment_id],
}),
...
}))
export const userRelation = relations(users, ({ one, many }) => ({
...
payment_history: many(payment_history),
...
}))
export const paymentHistoryRelations = relations(payment_history, ({ one, many }) => ({
...
last_payment: one(users, {
fields: [payment_history.user_id],
references: [users.last_payment_id],
}),
...
}))