Skip to content

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

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#10
Upd4ting merged 2 commits into
mainfrom
docs/field-relation-examples

Conversation

@MrSociety404

@MrSociety404 MrSociety404 commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

The table-declaring examples in the docs predate the @Field/@Relation decorators and still teach 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 column in every example (docs/2.table-definitions.md, docs/3.table-modifiers.md).
  • @Relation({ to: () => User }) added on the foreign-key fields (UserActivity.userId, Post.authorId), consistent with the file's own Relation section.
  • Intro prose updated: it taught "declare fields with TypeScript's declare keyword" with no mention of @Field.

Only the sections dedicated to @Field and @Relation themselves were already up to date; everything else is aligned on the same conventions (@Index@Field@Relation, @Field(\"any\") for object payloads, @Field(\"date\") for dates).

Greptile Summary

This PR updates the table documentation to show the current decorator-based table style.

  • Added @Field decorators to table fields in the examples.
  • Added @Relation decorators to foreign-key examples.
  • Updated example imports and intro text to match the decorator usage.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
docs/2.table-definitions.md Updates table-definition examples with @Field, relation metadata, and the imports needed by the shown snippets.
docs/3.table-modifiers.md Updates modifier examples so decorated fields are also declared with @Field.

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

Comment thread docs/2.table-definitions.md
Comment thread docs/2.table-definitions.md
Comment thread docs/2.table-definitions.md
@MrSociety404

Copy link
Copy Markdown
Member Author

@greptile review

Comment thread docs/2.table-definitions.md
Comment thread docs/2.table-definitions.md
@MrSociety404

Copy link
Copy Markdown
Member Author

@greptile review

@Upd4ting
Upd4ting merged commit f4488fb 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