drizzle-team / drizzle-team/drizzle-orm
[BUG]: pgSchema allow the value 'public' for schema name
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
v1.0.0-beta
### What version of `drizzle-kit` are you using?
v1.0.0-beta
### Other packages
_No response_
### Describe the Bug
The pgSchema doesn't allow 'public' schema name, but it would be very pratical for us to allow it.
We have an generic API share between multiple organization and the Postgres schema name is configurable. Some organization could fallback on public and some not. We find our self making workaround to define our table definitions to use the `pgSchema.table` or directly the `pgTableFn`. It would be much simplier and more ergonomic if we had only the `customSchema.table`.
```
export function pgSchema(name: T) {
if (name === 'public') {
throw new Error(
`You can't specify 'public' as schema name. Postgres is using public schema by default. If you want to use 'public' schema, just use pgTable() instead of creating a schema`,
);
}
return new PgSchema(name);
}
```
Contributor guide
Assessment
This issue has not been assessed yet.