drizzle-team / drizzle-team/drizzle-orm
[BUG]: SET STORAGE PLAIN on postgres causes unknown data type in introspection
- 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?
0.45.2
### What version of `drizzle-kit` are you using?
0.31.10
### Other packages
_No response_
### Describe the Bug
I am working with Nile Database and following the steps [in the docs](https://orm.drizzle.team/docs/tutorials/drizzle-with-nile). The documented process only introspects the `public` schema and outputs the `tenants` table, but I am also using Nile Auth which uses additional db schema `users` and `auth`. I added these to `schemaFilter` in config to include those in the output drizzle schema.
The schema output for the additional tables includes a number of fields where the data type could not be identified:
```
// TODO: failed to parse database type 'provider_auth_type'
authType: unknown("auth_type").notNull(),
```
Checking the DDL in DBeaver shows that the fields in question all have `SET STORAGE PLAIN` applied to them:
```
ALTER TABLE auth.credentials ALTER COLUMN "method" SET STORAGE PLAIN;
```
I don't believe that setting the storage strategy on a column should prevent `pull` from inferring the correct data type, in this case `varchar`.
I did manually change the column type to `varchar` and ran `drizzle-kit migrate` to see what was generated, and it includes an unnecessary `ALTER TABLE` statement to set the data type on that column:
```
ALTER TABLE "auth"."credentials" ALTER COLUMN "method" SET DATA TYPE varchar;--> statement-breakpoint
```
Contributor guide
Assessment
This issue has not been assessed yet.