drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

[BUG]:drizzle-kit works incorrectly for migrations with Typescript enums

Open jonl500 opened this issue 8 months ago • 0 comments

Report hasn't been filed before.

  • [x] I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.42.0

What version of drizzle-kit are you using?

0.30.6

Other packages

No response

Describe the Bug

The bug occurs it seems due to an issue between nodenext in the tsconfig.json file as the module. I am working with postgres as my db. From what I gathered it has to do with esnext in terms of and I believe I am using the latest stable version of Typescript. I do also know that sometimes while using nodenext there is a whole extra configuration required, so there is a chance I messed something up along the way. I am adding .js to import paths as required by my module but this seems to cause an error. Further, I tried pointing to a compiled file, but that did not work all too well due to other errors.

The undesired behavior is the error due to being unable to read my import while using drizzle-kit to generate and push... Ideally it would work or at least have i workaround/fix that I overlooked so that I can easily handle migrations with minimal overhead. I have a feeling this is likely something that has an existing bug report.

I cut out the full paths just as good practice.

No config path provided, using default 'drizzle.config.ts' Reading config file '/Projects/MyProject/drizzle.config.ts' Using 'postgres' driver for database querying Error: Cannot find module './dbEnums.js' Require stack:

  • /src/core/db/schema.ts
  • /node_modules/drizzle-kit/bin.cjs at Function. (node:internal/modules/cjs/loader:1225:15) at Module._resolveFilename (/node_modules/drizzle-kit/bin.cjs:16751:40) at Function._load (node:internal/modules/cjs/loader:1055:27) at TracingChannel.traceSync (node:diagnostics_channel:322:14) at wrapModuleLoad (node:internal/modules/cjs/loader:220:24) at Module.require (node:internal/modules/cjs/loader:1311:12) at require (node:internal/modules/helpers:136:16) at Object. (/src/core/db/schema.ts:4:45) at Module._compile (node:internal/modules/cjs/loader:1554:14) at Module._compile (/node_modules/drizzle-kit/bin.cjs:14260:30) { code: 'MODULE_NOT_FOUND', requireStack: [ '/src/core/db/schema.ts', '/node_modules/drizzle-kit/bin.cjs' ] }

jonl500 avatar Apr 21 '25 23:04 jonl500