Let a view field show one field of its related record
Merged
FE
3d ago+0+0+0123456789-0-0-0123456789
Adds viewField.relationTargetFieldMetadataId so an added column on a many-to-one relation can show one field of the related record, e.g. Person → Company › Industry (a lookup column). Server side only; the front end follows in #30439.
Changes
- Schema: nullable FK to
fieldMetadata,ON DELETE CASCADE, partial index; mirrorsviewFilter.relationTargetFieldMetadataId. Fast instance command2.59.0_AddViewFieldRelationTargetFieldMetadataIdFastInstanceCommand_1794606690417. - Lifecycle: deleting or deactivating the target field removes the lookup column instead of leaving a dangling id. The update util resolves both foreign keys in one call.
- Validation (view-field validator, create and update, using
findFlatEntityByUniversalIdentifier): only on non-canonical columns of a many-to-one relation; the target must belong to the related object and must not be a relation (one hop). - Public surface:
ViewField.relationTargetFieldMetadataIdon the type and on the create, update andupsertViewFieldWithScope(#30466) inputs, so the Edit column panel saves a lookup column in one request;nullon update clears it. Manifests carry it asrelationTargetFieldMetadataUniversalIdentifier(documented inlayout/views.mdx). - Every place that builds a view field sets the new property, including a type-only edit to the released 2-26 command. Client SDK and front metadata schema regenerated.
Stack
Merge top to bottom. Size counts changed lines outside tests and generated files: S < 300, M 300–800, L > 800. Sizes are a snapshot and are not kept in sync with every push.
| # | PR | Area | What it does | Size | Code | Tests / generated |
|---|---|---|---|---|---|---|
| 1 | #30339 | server | Per-column settings on view fields (label, record limit) | S | +300 −2 | +703 −152 |
| 2 | #30341 | server | A view can be owned by a one-to-many view field (scope view) | M | +584 −56 | +892 −4 |
| 3 | #30347 | server | Honor filter / orderBy / first on nested one-to-many connections | M | +462 −86 | +509 |
| 4 | #30465 | server | Each alias of a nested relation gets its own arguments and rows | L | +556 −273 | +665 −21 |
| 5 | #30348 | front | Extra table columns and the Edit column panel | M | +718 −76 | +152 −30 |
| 6 | #30466 | server | upsertViewFieldWithScope: save a column and its scope in one migration (~600 lines moved out of view-widget-upsert) | L | +1323 −567 | +1061 −256 |
| 7 | #30468 | front | Query a relation under an alias with its own filter, sort and limit | S | +140 −19 | — |
| 8 | #30469 | front | Save record filters and sorts to a given view (replaces the old hooks) | M | +341 −348 | — |
| 9 | #30349 | front | Scope one-to-many columns from the Edit column panel | L | +1053 −92 | +316 −18 |
| 10 | #30438 👈 | server | Lookup: a view field shows one field of its related record | M | +290 −39 | +476 −4 |
| 11 | #30439 | front | Lookup columns in the table | L | +712 −188 | +283 −30 |
| 12 | #30440 | front | Edit a looked-up field from its cell | S | +93 −35 | — |
| 13 | #30458 | front | Lookup and scoped columns on boards and calendars | M | +404 −284 | +140 −7 |
Off the main line:
- #30450 (server, S, code +31, tests +222): Expose lookup columns and column scopes in the view AI tools (branches off #30438)
Testing
- Integration
view-field-relation-target: accepted lookup on an added column; rejections (canonical column, non-relation, one-to-many, field of another object, relation target); column removed when the target field is deleted; saving and clearing a lookup throughupsertViewFieldWithScope, and rejecting a relation target there. - Unit:
validate-flat-view-field-relation-target, field deactivation side effects, manifest converters and snapshots. view-owner-view-field,view-field-settingsandupsert-view-field-with-scopeintegration specs pass. Server typecheck and lint.
Generated by Claude Code