drizzle-team / drizzle-team/drizzle-orm

drizzle kit relation naming causes inconsistency

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

Description

Currently, drizzle does not include the column name in the introspected relation name in relations.ts if only one column references a certain table, the relation is named: [tableName] and not [tableName]_[columnName].
This makes the naming **unstable** because when another column related to the same table is added, the first relation name stops making sense.
In my use case, I have a table for translations table that many other tables reference. The first translation added to a table always creates a relation whose name makes no sense ("translation" vs "name_translation").

I want to be able to configure drizzle to always include the column name in the relation name. It might be good for that to be the default, but I'd be happy with any solution.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.