Drizzle Team

DT

Drizzle Team

The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!

Join

PostgreSQL RQB truncation

I have a fairly nested query using the RQB and I'm running into issues where PostgreSQL truncates the identifiers used to 64 characters (as it normally does). In wondering if it makes sense/if there is a way to make the identifiers used in the RQB always fit into the 64 character limit because the truncation results in duplicate identifiers and makes the query fail. I am happy to send an example schema/error if that makes anything easier.

Drizzle Count # of Records

What would be the best way to count records in drizzle? Thanks!

Spatial Query in Drizzle using MySQL

I'm not able to find an example of how to create a Spatial Index as explained in this tutorial. https://www.endpointdev.com/blog/2021/03/spatial-queries-with-mysql/ Can I please get some help with how to do the following in Drizzle ORM?...

drizzle-orm doesn't compile

I've just created a blank typescript project for nodeJs and installed the library as specified in Drizzle doc. In the index.ts file of the project, I have the following code: ``` import { integer, pgTable, text } from 'drizzle-orm/pg-core';...

drizzle migration on nextjs

I am getting this error while using drizzle migration as show in the documentations. I have already set my compiletarget to es2017 and enabled topLevelAwait feature but still giving this error NB: everything works if I comment out the migration code on my drizzle db connextion setup...

findmany doesn't easily allow gte or lte?

When looking at the typescript definition of the operators in the findmany where clause I see: ``` declare const operators: { sql: typeof sql;...

How to set a default timestamp_ms for sqlite

How do I make a default timestamp_ms? ```createdAt: integer("createdAt", { mode: "timestamp_ms", })...

Migrations not being applied (drizzle-orm/node-postgres/migrator)

im kind of struggling with migrations... i have the following migration index.ts which i run whenever i generate a new migration ```ts import { drizzle } from "drizzle-orm/node-postgres"; import { migrate } from "drizzle-orm/node-postgres/migrator"; import pg from "pg";...

Delete limit

Hi, how do I delete just 1 row from a table?
// Example:
db.delete(dogs).where(eq(dogs.breed, 'husky')).limit(1)
// Example:
db.delete(dogs).where(eq(dogs.breed, 'husky')).limit(1)
...

Many to many - Planetscale

Anyone here has an example of declaring many to many relationship when using Planetscale? https://orm.drizzle.team/docs/rqb#many-to-many When using Planetscale this section doesn't work at all...

Inserting with Relation

Hi, What is the way of inserting a new record with a relationship in Drizzle. I understand that Prisma abstracts this away as if you are inserting everything as once but under the hood it breaks it up into multiple queries. Is there anything like this in drizzle?...

sql escaping on where

Trying to do the following:
where: sql`unaccent(${users.fullName}) ILIKE unaccent('%${input.query}%')`,
where: sql`unaccent(${users.fullName}) ILIKE unaccent('%${input.query}%')`,
...

Broken typescript in select

Whatever I put inside the select function. it will generate this typescript error: I am using the lastest ts- and drizzle versions....

Passing SQL functions to insert

Is there any way to pass a SQL function like gen_random_uuid() to the insert function, for a specific (non-primary ID) column? Something like concat('foo_', gen_random_uuid()) for example.

Drizzle-kit database push connection error

When trying to run drizzle-kit push:mysql to push my schema to Planetscale, I get the following error. Am I missing something? ```sh drizzle-kit push:mysql...

Typescript error when importing the planetscale-drizzle db instance.

my db is hosted on planetscale and im trying to do the setup as explained in the drizzle docs but when I import db instance i get the following error. My code ```js import * as schema from './migrations/schema';...

Mapped column name and relation with the original name

Hi, I am taking over an old project and have found an issue, I'm not sure if I should file it as a bug: I have two MySql tables here is the oversimplified version: ``` events - id...

How to properly do foreign keys in schema with PlanetScale?

I'm aware that foreign key constrains aren't supported, but foreign keys themselves are. push: ```json sqlMessage: 'VT10001: foreign key constraints are not allowed'...

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