Issue with drizzle-kit and enums

I have an issue with drizzle-kit and enums and can't find a solution. I am trying to use drizzle with Supabase. When I run npx drizzle-kit push is when I get an error if the schema contains a pgEnum. If the database is fresh and the enum doesn't exist and I run that command the error I get is this:
npx drizzle-kit push    
No config path provided, using default 'drizzle.config.ts'
Reading config file 'C:\...\Documents\Dev\JS\projectName\drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
error: type "brush_type" does not exist


If I create the enum manually in Supabase, the error I get is this:
npx drizzle-kit push     
No config path provided, using default 'drizzle.config.ts'
Reading config file 'C:\...\Documents\Dev\JS\projectName\drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
error: cannot drop type brush_type because other objects depend on it


This is my schema configurations.ts:
import {
  integer,
  pgEnum,
  pgTable,
} from "drizzle-orm/pg-core";

const brushTypeEnum = pgEnum("brush_type", ["THREAD", "MIXED", "CARLITE"]);

export const configurations = pgTable("configurations", {
  id: integer().primaryKey().generatedAlwaysAsIdentity(),
  brush_type: brushTypeEnum("brush_type").notNull(),
});


This is my
drizzle.config.ts
:
import "dotenv/config";
import { defineConfig } from "drizzle-kit";

if (!process.env.DATABASE_URL) {
  throw new Error("Missing DATABASE_URL environment variable");
}

export default defineConfig({
  out: "./drizzle",
  schema: "./db/schemas/configurations.ts",
  dialect: "postgresql",
  dbCredentials: {
    url: process.env.DATABASE_URL,
  },
});


I am out of ideas so any help is well appreciated.
Was this page helpful?