Drizzle Team

DT

Drizzle Team

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

Join

SQL_PARSE_ERROR: SQL string could not be parsed: near LP, "None"

Full error:
Error: SQL_PARSE_ERROR: SQL string could not be parsed: near LP, "None": syntax error at (1, 50)
Error: SQL_PARSE_ERROR: SQL string could not be parsed: near LP, "None": syntax error at (1, 50)
...

Binary typing for Mysql & typescript

hey hopefully quick question, I have a mysql column of type binary(32), but the type coertion seems to only be accepting strings ``` // type definition signingKey: binary('signing_key', { length: 32 })...

Db race condition

Is there any tool with drizzle that can help with handling race conditions?

Setting up Drizzle with Supabase in Next.js App Router

Hey Drizzle Team, absolutely love what you are building, but i run into a few problems setting it up. I am using Next.js App router and Supabase. This is my current setup: drizzle.config.ts ```...

Select filters for n tables on relational queries

Let's just use the schema from the docs: Users has many Posts This would give me User 1 with all of their posts: `const res = await db.query.users.findMany({ where: eq(users.id, 1), with: {...

Querying Best Practices?

Just want to discuss query best practices. ```ts const userAccount = await db.query.accounts.findFirst({ where: eq(accounts.id, userId), with: {...

Using the drizzle object mapping API directly in combination with raw queries

If I were to use the raw query interfaces or even use the underlying database driver to query the database directly, is it possible to use Drizzle to handle mapping of rows to the drizzle schema? I understand it would have it's limitations but I'm really looking to leverage all the custom types and to/from driver translations I have

whats the difference.

Whats the difference of using references like this: ``` export const profileInfo = pgTable('profile_info', { id: serial('id').primaryKey(), userId: integer("user_id").references(() => users.id),...

There are multiple relations between "places" and "medias". Please specify relation name

Hello guys, could someone help me? I'm getting the following error: Error: There are multiple relations between "places" and "medias". Please specify relation name...

Count of one-to-many relation in query

Migrating from Prisma - I had something like the following: ``` export async function getAllOrganizations() { return db.organization.findMany({...

onDelete cascade, Error: VT10001: foreign key constraints are not allowed

Trying to add onDelete cascade and db push produces this error: foreign key constraints are not allowed ```...

How to handle adding new columns to schema?

I have a schema, but I've decided I need to add a new column. I change the schema.ts file, push, and get the error ``` LibsqlError: SQLITE_UNKNOWN: SQLite error: table work_experience has 7 columns but 6 values were supplied...

drizzle push and primary key order

right now the primary key order isn't respected at least on MySQL work around is i just fix it manually using alter table statements but all my coworkers have to do this also - ideally this can be respected...

Drizzle can't find local sqlite file

I'm trying to play around with sqlite but I can't seem to connect my config and local sqlite db file. Config: ```ts import type { Config } from 'drizzle-kit';...

How to debug Drizzle queries

I'm executing an insert on a table, I'm gettin no errors, and yet the data is not being saved to the database. Just curious how I am supposed to debug stuff like this since I have no idea why it isn't working....

TypeError: Cannot read properties of undefined (reading 'referencedTable')

Here is the relational query that I'm trying to execute (Turso SQLite): ```javascript const result = db.query.product .findMany({ where: (product) => inArray(product.id, keys),...

Querying with two consecutive WITH causes error "the table is not part of the query"

I created my query by stages. I create a part, check it's result via await and .all() then I turn it to CTE ($with) and use in from() of the next stage. The first part (screenshot 1) 1. Worked well via direct await 2. Worked well when turned into $with and used in .from() of next stage...
No description

[Fixed] - Next.js remaining connection slots are reserved for non-replication superuser connections

I am frequently getting the above error. Database: Supabase Github: https://github.com/ShaikRehan123/questionPaperCreation ...
Solution:
Did you try to restart your Supabase instance? It happened to me sometime after a deploy on fly.io (with Remix, so we can agree it's not related to a specific platform/framework)

[drizzle-zod] How to make all fields of a schema derived from a table required ?

I just tried the plugin and I'm happy to move from manually creating zod schemas. However, I came into a use case where a schema must have all nullable fields in the table required. Assume we have these in users table: ```typescript...