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 - Overview
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
4 Replies
BitShift
BitShift7mo ago
Does my problem have anything to do with the note at the bottom of this section? https://orm.drizzle.team/kit-docs/faq#how-do-i-apply-migrations-generated-by-drizzle-kit
Drizzle ORM - FAQ & Troubleshooting
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
BitShift
BitShift7mo ago
GitHub
[BUG]: migrate fail on add column · Issue #1354 · drizzle-team/driz...
What version of drizzle-orm are you using? ^0.28.6 What version of drizzle-kit are you using? ^0.19.13 Describe the Bug sql1 CREATE TABLE IF NOT EXISTS "sys_user" ( "id" bigseri...
BitShift
BitShift7mo ago
I'm gonna have to switch over to using the drizzle-kit cli until this is resolved I guess.
BitShift
BitShift7mo ago
GitHub
Add a programatic JavaScript API · Issue #181 · drizzle-team/drizzl...
I'm currently working on a CMS. It automatically feeds data from markdown, json and yaml into SQLite DB for user-friendly querying. Our library, and not the user, generates the Drizzle schemas ...
Want results from more Discord servers?
Add your server