docs: resolve OQ-11 and OQ-12 with ADR-015 and ADR-016

ADR-015: <table> accepts extraConfig prop mirroring Drizzle's third
callback argument for composite unique constraints and other
column-reference-based features.

ADR-016: Adapter accepts Type.Module compiled bundle (not individual
schemas). M.Import() handles ref resolution automatically, eliminating
potential complications with separate schema wiring.

Update FromDbTypeConfig interface to use module instead of schema,
update element types table with extraConfig prop.
This commit is contained in:
2026-05-23 13:02:23 +00:00
parent 98764086f4
commit da65f7b693
5 changed files with 152 additions and 9 deletions

View File

@@ -21,7 +21,7 @@ interface FromDbTypeConfig {
db: AnyDrizzleDB // Drizzle database instance
tables: Record<string, UElement> // UJSX table elements
host: HostConfig<...> // Rendered dialect host
schema?: Record<string, TObject> // Optional: Type.Module entries for select/insert/update
module: TModule // Compiled Type.Module bundle (accessed via M.Import())
operations?: Record<string, OperationSelection> // Per-table operation selection
accessControl?: Record<string, AccessControlMap> // Per-table access control
}
@@ -145,7 +145,7 @@ Overrides replace the auto-generated handler but keep the auto-generated `Operat
1. ~~**Per-dialect handler differences?**~~ **Resolved — ADR-012**. Always use `.returning()` with graceful fallback. Dialects that support it return data; dialects that don't fall back to validated input or affected row count.
2. **Schema bundle or separate schemas?** Should the adapter accept the `Type.Module` compiled bundle, or individual schemas? The module is convenient (everything in one place) but couples the adapter to TypeBox's module format. (See [OQ-12](open-questions.md))
2. ~~**Schema bundle or separate schemas?**~~ **Resolved — ADR-016**. The adapter accepts the `Type.Module` compiled bundle. `M.Import()` handles ref resolution automatically, which eliminates potential complications with separate schema wiring. Consistent with ADR-010 (derived schemas in the module).
3. ~~**Relation rendering responsibility?**~~ **Resolved — ADR-013**. The adapter generates relations from module entries and rendered table objects. No new `<relation>` element type is needed.