Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enums broken when instrospecting with schemaFilter #361

Open
ViggoV opened this issue Apr 17, 2024 · 1 comment
Open

Enums broken when instrospecting with schemaFilter #361

ViggoV opened this issue Apr 17, 2024 · 1 comment

Comments

@ViggoV
Copy link

ViggoV commented Apr 17, 2024

I have been having some issues when instrospecting a postgres schema with enum types. The PgEnums are generated in the Drizzle schema, but the columns that use them get an unknown() type. It looks like this

export const colorEnum = pgEnum('color_enum', ['red','green','blue'])

export const myDbSchema = pgSchema('my_db_schema')

export const sillyHat = myDbSchema.pgTable('silly hat', {
  id: serial('id').primaryKey(),
  // TODO: failed to parse database type 'fraud_dev.variable_type'
  color: unknown('hat')
})

Based on the inserted comment I believe the issue is that drizzle-kit is trying to access the enum on myDbSchema, but the actual enum is defined outside it, on the database itself.

@ldurazo
Copy link

ldurazo commented Apr 18, 2024

Similar if not the same issue I'm running into, is that colorEnum in my case is part of myDbSchema but introspected as if part of the default (public) schema.

This means that the migration file will create a duplicate of myDbSchema.colorEnum aspublic.colorEnum, which will fail postgres operations due to the schema mismatch on the enum, since they're technically different objects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants