Skip to content

docs: declare table fields with @Field and @Relation decorators in examples - #19

Merged
Upd4ting merged 2 commits into
mainfrom
docs/field-relation-examples
Jul 13, 2026
Merged

docs: declare table fields with @Field and @Relation decorators in examples#19
Upd4ting merged 2 commits into
mainfrom
docs/field-relation-examples

Conversation

@MrSociety404

@MrSociety404 MrSociety404 commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #16, which migrated the test fixtures: the table-declaring examples in the docs still used the legacy style (bare declare fields). Since properties without @Field are omitted from the TableDefinition.fields map handed to the adapter, the examples produced tables with no field definitions.

  • @Field(type) added on every table column in every example.
  • @Relation({ to: () => Target }) added on foreign-key fields — notably in the foreign-keys and joined docs, which document cross-table references without declaring the relation at the table level (Order.userId, Cart.items with many: true, Device.group_id).
  • Data-controller field declarations are untouched: @Field is a table-level (database-decorators) concern.

Files

  • docs/1.introduction.md
  • docs/2.data-controllers.md
  • docs/7.foreign-keys.md
  • docs/9.modifiers.md
  • docs/10.joined.md
  • docs/11.computed.md

Greptile Summary

This PR updates the docs examples to use table field metadata consistently.

  • Added @Field decorators to table column declarations.
  • Added @Relation metadata to foreign-key fields.
  • Clarified many: true table metadata versus controller-side multi-value resolution.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
docs/1.introduction.md Adds Field to the imports and annotates the user table fields.
docs/2.data-controllers.md Adds Field to the imports and annotates the table model fields.
docs/7.foreign-keys.md Adds field and relation metadata to the foreign-key examples.
docs/9.modifiers.md Adds Field metadata to the localized content table example.
docs/10.joined.md Adds field and relation metadata to the joined data example.
docs/11.computed.md Adds field and relation metadata to the computed fields example.

Comments Outside Diff (1)

  1. docs/11.computed.md, line 14 (link)

    P1 Decorators Are Out Of Scope

    The example now uses @Field and later @Relation, but the code block still only imports Computed. Copying this example as written will fail to type-check with missing names for the table decorators, so the new field and relation declarations are not usable without adding the @antelopejs/interface-database-decorators import.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: docs/11.computed.md
    Line: 14
    
    Comment:
    **Decorators Are Out Of Scope**
    
    The example now uses `@Field` and later `@Relation`, but the code block still only imports `Computed`. Copying this example as written will fail to type-check with missing names for the table decorators, so the new field and relation declarations are not usable without adding the `@antelopejs/interface-database-decorators` import.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "docs: address greptile review feedback (..." | Re-trigger Greptile

Comment thread docs/7.foreign-keys.md
@MrSociety404

Copy link
Copy Markdown
Member Author

@greptile review

@Upd4ting
Upd4ting merged commit 097fff0 into main Jul 13, 2026
2 of 3 checks passed
@Upd4ting
Upd4ting deleted the docs/field-relation-examples branch July 13, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants