21 lines
660 B
TypeScript
21 lines
660 B
TypeScript
import { relations } from "drizzle-orm";
|
|
import { features } from "../../featureModels/featureTable.js";
|
|
import { organizations } from "../../orgModels/orgTable.js";
|
|
import { customers } from "../cusTable.js";
|
|
import { entities } from "./entityTable.js";
|
|
|
|
export const entitiesRelations = relations(entities, ({ one }) => ({
|
|
customer: one(customers, {
|
|
fields: [entities.internal_customer_id],
|
|
references: [customers.internal_id],
|
|
}),
|
|
feature: one(features, {
|
|
fields: [entities.internal_feature_id],
|
|
references: [features.internal_id],
|
|
}),
|
|
organization: one(organizations, {
|
|
fields: [entities.org_id],
|
|
references: [organizations.id],
|
|
}),
|
|
}));
|