drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: Dynamic Schema
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Describe what you want
It doesn't seem possible to use `pgSchema` or related with dynamic runtime values. (https://orm.drizzle.team/docs/schemas)
in #423, proposed solutions use a table factory to achieve this, and while this works with the query builder (with code duplication and bad DX), this is not viable for use with relational queries or drizzle-kit.
It is very common to use schemas for separating tables of different tenants in multitenant applications. The easiest way to support this would probably be with an addition to the `drizzle()` function, which could take an optional schema argument. The schema would apply to all the tables defined on the drizzle db instance.
Similarly, optional config with drizzle kit to specify a schema would solve the problem.
Contributor guide
Assessment
This issue has not been assessed yet.