Unable to use drizzle-orm migrator with drizzle-kit

So. I'm running into something pretty wild. I've got a bunch of migrations generated by dizzle kit, and they work when I execute them using drizzle kit. My database is hosted on neon pg. For some reason, when I try to write a script to perform migrations as part of my deploy process, results are very different. It's almost like it's not checking the existing DB schema before proceeding. Either way I can't migrate using something like import { migrate } from 'drizzle-orm/neon-serverless/migrator' or import { migrate } from 'drizzle-orm/neon-http/migrator'

More details:
  • I have 8 migrations, the first one was produced by introspection
  • The second migration alters an Enum ALTER TYPE "EntityTypes" ADD VALUE 'DATA_CLEANER_LEAD'; but I get this error on run error: enum label "DATA_CLEANER_LEAD" already exists
  • I'm trying to write a script that will perform migrations, it does not use the drizzle-kit cli see https://orm.drizzle.team/kit-docs/overview#running-migrations
And since drizzle-kit is closed source, I can't figure out if the delta between what drizzle-kit is doing and what my own code is supposed to be doing.
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Was this page helpful?