drizzle-team / drizzle-team/drizzle-orm

BUG: introspect generates broken schema when custom types are used

Open
#3,446 6 comments 9 reactions 0 assignees View on GitHub
bug bug/fixed-in-beta drizzle/kit
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

I'm using supabase for auth and db and I would like to use drizzle as the ORM.

To reference the user id I need to introspect the db against the `auth` schema. This runs successfully but the `schema.ts` is broken.

I'm going to post few of the broken parts (with custom types)
```
// TODO: failed to parse database type 'auth.factor_type'
factorType: unknown("factor_type").notNull(),
// TODO: failed to parse database type 'auth.factor_status'
status: unknown("status").notNull(),
```

Also, nullable text fields seem to have a problem:
```
phone: text("phone").default(NULL::character varying),
```
The part with `::character varying` is what makes it broken.

According to drizzle-team/drizzle-orm#3490, also custom functions generate broken schemas.

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.