Related Tables
Modeling parent-child relationships and joins with Drizzle ORM.
This guide has been moved to Relational Data Modeling & Joins.
Brick-TS models child tables and relational joins using pure Drizzle ORM and standard relational database constraints.
Please see the canonical guide: Relational Data Modeling & Joins.
Schema
The related-table example uses these application-owned tables. target_id is a logical reference; the example does not declare a SQL foreign key.
Table Name: articles
| Field | Type | Description |
|---|---|---|
id | text | Row identifier. PK Default: crypto.randomUUID() (application) |
title | text | Display title. |
Table Name: comments
| Field | Type | Description |
|---|---|---|
id | text | Row identifier. PK Default: crypto.randomUUID() (application) |
target_id | text | Logical parent article identifier; no SQL foreign-key constraint. |
body | text | Text content. |