Drizzle Team

DT

Drizzle Team

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

Join

Bun with drizzle

I am attemtping to use bun with drizzle-kit and i Keep getting this error I am using planetscale mysql2 driver...
No description

Get raw query from toSQL

I trying to figure out if drizzle has a function or helper built in that builds the raw query returned from toSQL right now toSQL returns params and sql as an object, i would like to get the raw sql query this is what im doing now to achieve this, any alternatives or is there a something drizzle provides i missed thanks ...

error: Cannot find module "@libsql/linux-x64-musl" from "~/todion/node_modules/libsql/index.js"

error: Cannot find module "@libsql/linux-x64-musl" from "~/todion/node_modules/libsql/index.js"
No description

Updating with a subquery

Can I do this in Drizzle without the raw SQL? ``js db.execute(sql UPDATE feeds AS f...

MySQL Blob

is there support for mysql blob type?

Prepared Statement - Neon Syntax Error

Hi there, I am trying to use a prepared statement to run a query but am getting a syntax error. below you can see the .toSql() logged, as well as the error. ```...

many to many relation problems

I'm using planetscale and can't seem to figure out what is wrong with this relation. There's no autocompletion for with when using the RQB and trying to access the table manually throws an referenced table error ```ts // schema export const organizations = mysqlTable("organizations", {...

Getting typescript errors with latest version

I am currently getting this error when i upgraded to the latest version. The schema was auto generated by drizzle....
No description

Select data from related table as well

I have 2 tables: ```javascript export const foos = pgTable( "foos", {...

Subqueries with INSERT - errors

I'm trying to create an insert that uses a subquery ```ts const sq = db.select({id: orgs.id}).from(orgs).where(eq(orgs.publicId, input.orgPublicId)).as('sq'); const insertOrgResponse = await db.insert(orgInvitations).values({ orgId: sq.id,...

Postgres read slaves?

Is there a way to connect the orm to use a read slave for selects and master for writes?

Migrate using Neon and Sveltekit

this is my code ```ts import { pool } from '$lib/server/db'; import { drizzle } from 'drizzle-orm/neon-serverless'; import { migrate } from 'drizzle-orm/neon-serverless/migrator';...

Cannot find driver! mysql2 or pg.

I'm trying to run drizzle-kit studio can get this error: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'mysql2' imported from C:\Users\rober\code\projects\drizsup\node_modules\drizzle-orm\mysql2\index.mjs Here is my drizzle.config.ts: ...

Relationships: Self one-one & one-many

I have a table called convoMessages Trying to add a self relation of one to one But also a self relation of one to many Drizzle Studio is throwing an error of ...
No description

No transactions support in neon-http driver even though neon provides a transaction function

https://neon.tech/docs/serverless/serverless-driver#when-to-use-the-neon-function-vs-pool-or-client I tried to execute a db operation such as below. I am getting throw new Error('No transactions support in neon-http driver'); I'm not sure if the kind of code below is an "interactive" or "non-interactive" transaction, but wondering if maybe I am missing something. Does drizzle support the neon(...) transaction() function?...

push:mysql dropping unique index

i think drizzle generates the following when it needs to drop a unique index
ALTER TABLE `stage` DROP CONSTRAINT `name`;
ALTER TABLE `stage` DROP CONSTRAINT `name`;
...

any way to push to a sqlite database using javascript? without using the command

I am making an app with electron and wants to save some data in a sqlite database using drizzle orm but i want the sqlite database file to be automatically created with the schema the first time the app launches

Transactions for DB reset in testing

Hi, has anyone leveraged DB transactions as a wrapper around all DB calls within a test so that it can be rolled back at the end of a test process (We're currently purging all tables directly, but that seems inefficient really).

pgEnum in multiple tables

How should I use the same enum in multiple tables? For example I have this enum in: ``` const ROLES = ['owner', 'admin', 'editor', 'viewer'] as const const roleEnum = pgEnum('role', ROLES)...