DT
Drizzle TeamHegarGarcia

Typescript path alias not working properly

I'm new to Drizzle, but I'm not able to use the path alias on schema files. Using absolute paths on the imports works without a problem, but when using any @/... path everything breaks. Right now I'm working around this problema by denying @/ imports wit ESLint but that is not a good solution long term.
No description
HegarGarcia
HegarGarcia321d ago
This also applies for the drizzle.config.ts
ulic
ulic243d ago
Ever find a solution other than relative imports?
Angelelz
Angelelz243d ago
Make sure that the rules on your bundler apply in the folder/files where you are having those issues. Also, if you are running tsc vs ts-node vs tsx to run drizzle kit commands they may or may not see your tsconfig
ulic
ulic243d ago
I'm using vite with tsconfigPaths, but admittadly don't know much about that stuff. The issue I'm having is when trying to generate migrations and the schema uses path alias for importing consts. I guess it's specifically a drizzle-kit thing as the bundler isn't doing anything for migration generation
Angelelz
Angelelz243d ago
Can you type the command you use to run drizzle-kit migrate? Drizzle-kit is not a standalone command, you must be using tsc, ts-node or any other Typescript runned
ulic
ulic242d ago
pnpm drizzle-kit generate:mysql
Angelelz
Angelelz242d ago
There go you, pnpm is not going to look at your tsconfig and resolve the paths
PizzaConsole
PizzaConsole240d ago
@ulic.75 You can do this:
No description
No description
ulic
ulic239d ago
@poisnfang huzzah! That is fantastic. Thank you so much.
Want results from more Discord servers?
Add your server
More Posts
Expand query from ID using .select()Hi! I am trying to get the first name of a comment author, but only store the ID so the user can chaPGEnum -> Typescript EnumHey there. Is there any convenient way people have found to conveniently turn a pgEnum into a typescIs Drizzle Kit/Drizzle Studio possible with RDS Data API?I'm able to create the RDSDataClient for querying my DB using Drizzle ORM, but I don't see a way to How to apply migrations on postgres in a serverless enviroment?Hello, I want to apply postgres migrations to my vercel DB. I see that the push command does not woError when trying to generate a migration schemaanyone any ideas to what the problem is? It was working fine yesterday and now it throws an error whModelling self relationsI have a table `categories` with a parent fields: ``` { id: text("id").notNull().primaryKey(), .Issue running migrations to DBI am having an issue running migrations to Neon. I checked that everything is exporting const variabIt is possible to have prepared statements inside transactions?Is there a way to insert prepared queries inside a transaction ?type config findMany or findFirstHi, I've one question i don't find the way to type correctly findMany() Like: export async functionAny idea on how to pass a pool from postgres-pool to drizzle?Passing a single client works, but for better connection management it would help to be able to passHow to get another linked tables count?I am new to Drizzle ORM and I wanted to get another tables data in my api. This is my api ```ts impI created a next auth adapter for postgres-jsThe open PR was not working for me so I created a new adapter. I added it to a starter project so pe.prepare() in Next.js App RouterHello! I'm trying to use PostgresQL prepared statement in the Next.js App Router and I have been getDeleting records w/ sqlite-core.Hello all, hoping to find some clarity/direction. So I'm trying to delete a record using; ```ts expCan't figure out how to design relational queryI have three tables - categories - products - media I want to retrieve products that belong to a padrizzle-zod@0.4.4 with drizzle-orm@0.26.5added drizzle-zod to my project and I am getting this error when starting the dev server - error ./ERR_MODULE_NOT_FOUND while generating migration files```ts import type { Config } from 'drizzle-kit'; export default { schema: './lib/db/schema/*', Typescript error with custom column typeThe select rules throws a TS error: "Expected 0 arguments, but got 1.ts(2554)" What am I doing wrongInfer TS types with `sql` operator and `db.execute````ts const db = drizzle(connection); export async function getTodos() { const result = await db.eMigrations not working with Neon.Tech?So i was trying to use drizzle for the first time. a little bit of a noob but im not sure what im do