checkSoftRelations() — drizzle-orm Function Reference
Architecture documentation for the checkSoftRelations() function in softRelations.test.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 4ea0c5bc_d91f_06d3_0e94_b169c6765723["checkSoftRelations()"] 2aaeacf2_fda7_2e7f_695d_dd6c7bb82df9["softRelations.test.ts"] 4ea0c5bc_d91f_06d3_0e94_b169c6765723 -->|defined in| 2aaeacf2_fda7_2e7f_695d_dd6c7bb82df9 style 4ea0c5bc_d91f_06d3_0e94_b169c6765723 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-seed/tests/pg/softRelationsTest/softRelations.test.ts lines 133–171
const checkSoftRelations = (
customers: (typeof schema.customers.$inferSelect)[],
details: (typeof schema.details.$inferSelect)[],
employees: (typeof schema.employees.$inferSelect)[],
orders: (typeof schema.orders.$inferSelect)[],
products: (typeof schema.products.$inferSelect)[],
suppliers: (typeof schema.suppliers.$inferSelect)[],
) => {
// employees soft relations check
const employeeIds = new Set(employees.map((employee) => employee.id));
const employeesPredicate = employees.every((employee) =>
employee.reportsTo !== null && employeeIds.has(employee.reportsTo)
);
expect(employeesPredicate).toBe(true);
// orders soft relations check
const customerIds = new Set(customers.map((customer) => customer.id));
const ordersPredicate1 = orders.every((order) => order.customerId !== null && customerIds.has(order.customerId));
expect(ordersPredicate1).toBe(true);
const ordersPredicate2 = orders.every((order) => order.employeeId !== null && employeeIds.has(order.employeeId));
expect(ordersPredicate2).toBe(true);
// product soft relations check
const supplierIds = new Set(suppliers.map((supplier) => supplier.id));
const productsPredicate = products.every((product) =>
product.supplierId !== null && supplierIds.has(product.supplierId)
);
expect(productsPredicate).toBe(true);
// details soft relations check
const orderIds = new Set(orders.map((order) => order.id));
const detailsPredicate1 = details.every((detail) => detail.orderId !== null && orderIds.has(detail.orderId));
expect(detailsPredicate1).toBe(true);
const productIds = new Set(products.map((product) => product.id));
const detailsPredicate2 = details.every((detail) => detail.productId !== null && productIds.has(detail.productId));
expect(detailsPredicate2).toBe(true);
};
Domain
Subdomains
Source
Frequently Asked Questions
What does checkSoftRelations() do?
checkSoftRelations() is a function in the drizzle-orm codebase, defined in drizzle-seed/tests/pg/softRelationsTest/softRelations.test.ts.
Where is checkSoftRelations() defined?
checkSoftRelations() is defined in drizzle-seed/tests/pg/softRelationsTest/softRelations.test.ts at line 133.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free