drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: custom meta data for models and fields

Open
#1,330 4 comments 3 reactions 0 assignees View on GitHub
drizzle/kit enhancement
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Describe what you want

Hi,
Having the ability to attach custom metadata to models and fields could help make drizzle significantly useful for concerns that go beyond database interaction, e.g. auto forms generation, data bootstrapping scripts.

There are a few important areas where automatic code generation can help significantly speed up the app development process. These areas are also closely related to the model. For example:
- form generation. Metadata can be used to indicate the preferred form type: e.g., select dropdown vs autocomplete combobox, whether select values are conditioned on another field, whether a field should be displayed or required in CRUD forms, etc.
- admin site generation
- potential to leverage these metadata to customize the drizzle studio with application specific constraints. This could turn drizzle studio immediately into an admin site.
- auto generation of field values, e.g. `slug` field that is the slugified value of another field, or `sum` field that is the total of `a` field and `b` field.

Having this sort of meta data live with the model themselves makes sense because this type of metadata actually help describe the model constraints.

P.S. This isn't a new idea on my part. It's mostly influenced by the Django ORM. I'd love to see this available as it would immensely speed up the data model iteration part of app development.

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Start by reviewing how Drizzle defines models and fields, then clarify the metadata shape and supported use cases before assessing an implementation. Done would require an agreed design and a complete path for attaching and consuming custom metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.