Drizzle not creating enum
Hey guys, I am using drizzle in my project with postgres. I create a new enum(with pgenum) but the generate sql is missing the definition of the enum.
and using this as
status: status().notNull().default('created')
and here's the generated sql
there's no definition of enum12 Replies
you have to export everything
Drizzle doesn't know you created an enum because you didn't export it
I did export it
@Phantom Assuming you're already exporting the status enum, in what file is that enum present in and what's the schema path in your Drizzle config file?
Okay. What you added here just says
const status
so that was the quickest solution.
If you have that in the actual file, then I don't think you actually have an issue.
Drizzle would create the enum and then create the table.this is the column
the sql file was missing the
CREATE TYPE status AS ENUM
I added that manually
I'll submit a minimal reproduction tomorrowthis is my exact dilema, any permanent fix yet? i had to create the type manually in the migration file.
I gave up on drizzle
and reverted back to prisma
damn, sad. i can't give up now. they need to fix this.
Phantom, didn't provide much to go on so helping is hard. Share your schema and maybe your config.
Also share the output of
drizzle generate
so i kind of hacked my way around, i used and all was well with the world for a while.
thank you for offering to help.
you need include the enum in your exported schema
They claim to have already exported the pgEnum. That's the first suggestion I made.