How can I "tell" Drizzle if a migration is considered "done" or not when migrating from Prisma?
I'm migrating my project from Prisma to Drizzle following the migration guide and I've bumped into a problem. Drizzle correctly generates a migration file that says:
my problem is that this will fail when I start my application:
with:
so right after the unterminated
/*
that comes with the script. If I uncomment this script then it fails with:
I think this migration shouldn't run at all, since it was generated from my existing schema (so no migration is necessary). Is there a way to mark a migration as "done"? I checked and Drizzle created a drizzle
schema in my database and it has an empty __drizzle_migrations
table.12 Replies
Update: it seems that the migrator is buggy
if I run the generated migration against my database outside of Drizzle it works
but if I run it with drizzle I get errors
I narroved it down to this:
the problem is that drizzle converts these to lower case
so instead of
providerId
it looks for providerid
@Andrew Sherman ☝️
I debugged this@Andrew Sherman can you eyeball this? https://github.com/adam-arold/drizzle-orm/commit/2bb3b873f6d18b0c67db30fe97ca4e899946ffa7
it looks like that the driver itself is buggy
if you run the test i added and set a breakpoint here you'll see that the query is valid
but the client returns an error:
so somewhere along the line
providerId
is turned into providerid
i just tried it with postgres.js
and to my surprise I got the same error
it's not migrator error, just migration was generated without ""
I'll patch update drizzle-kit to generate migration properly
to not block you , you would need to add "" around providerId inside migration script generated by drizzle
I'll try to patch update now
oh.
there is a relevant issue on GitHub too
interestingly enough if i just copy the sql into dbeaver it executes without an error
is there a fix for the schemaless enum problem?
when i generate a migration from my current db schema it hardcodes
public
into all enum declarations
which leads to failures
ping?Ran into same issue -- thanks @addamsson for your notes here helped me understand!
FYI I ended up not migrating to Drizzle after facing numerous problems and drawbacks
I feel that, thanks for letting me know. What did you end up settling on? ORM/query builder/raw SQL/...
ive tried sequelize, prisma, knex, drizzle and a couple others in the TS ecosystem (not to mention other lang ecosystems) and still trying to find my place 😅
ill keep using prisma for the time being
once the performance becomes a huge issue I'll migrate to kysely. it was super fast to set up, generated the schema from my prisma file without issues and worked like a charm out of the box
Sweet! Thanks for that