Drizzle Team

DT

Drizzle Team

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

Join

Performance questions

I'm using Drizzle ORM with Planetscale DatabaseJS driver and my application has spots where I want to decrease number of HTTP requests to my database. I have following questions: 1. Does Drizzle+DatabaseJS make separate HTTP request for each query? (I know I should be asking this question to DatabaseJS creators, but asking here in case someone is aware of that) 2. If it does, what would be the best way to group several queries so that they are performed in one HTTP request?...

Can drizzle generate an initial schema from an existing db?

I have a db that wasn't built using drizzle, but I'm interesting in moving over to it. Do I need to manually write out a schema that matches that the db has, or is there a way to generate one via some command?

Prepared Stements

I was looking into using AWS RDS Proxy with Prisma and ran into this https://www.prisma.io/docs/guides/deployment/deployment-guides/caveats-when-deploying-to-aws-platforms#aws-rds-proxy I was wondering does DrizzleORM use prepared statements for everything like Prisma does? Would I run into the same issue if I switched to Drizzle?...

React Native Support

Hi all New to drizzle ORM, does it support React Native? Thanks...

update multiple rows

How can I update values in multiple rows at once?

Running `drizzle-kit introspect:pg` returns "client password must be a string"

I'm attempting to move from objection.js+knex.js over to Drizzle and I'm running drizzle-kit introspect:pg against my database but I'm getting the error:
Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
...

noob help : transaction not acid

``` return await this.drizzle.db.transaction(async (trx) => { const u = await trx .select({ usd: users.usd,...

Explicit inferred types

```ts async loginWithGoogle(user: NonNullable<Request['user']>) { const existingUser = await this.db.query.users.findFirst({ where: eq(users.email, user.email), });...

Many-to-Many where in far table

I'm trying to findMany() Pokemon(s) by a type name ``` pokemons pokemonsToType types ======== =============== =======...

Cannot call onConflictDoNothing() or on onConflctDoUpdate() on select

Hello guys, this is probably right in front of me, but when I insert at the end of values I cannot find .onConflict, just onDuplicateKeyUpdate. Many thanks!

Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020

Hey I just upgraded to the v^0.26.2 and I get the following error: ``` Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides) ...

can you Infer relations?

im really loving how drizzle plays well with relations, but im wondering is there a way to get types for relations? in prisma you can use Prisma.YourModelGetPayload<{}> to generate a type with relations, is this possible with infermodel? i tired the most obvious way and that didnt work
InferModel<typeof userRelations>;
InferModel<typeof userRelations>;
...

subRows.map is not a function

I am getting a subRows.map is not a function error when adding the "with" parameter to my relational queries. here is my schema; ```export const users = pgTable("users", {...

Postgres's Serial column type doesn't automatically have a default

Hello, when using postgres's serial types, and setting them as primary keys, there is an issue currently that does not mark them as has default. What I mean is, from the docs The data types smallserial, serial and bigserial are not true types, but merely a notational convenience for creating unique identifier columns (similar to the AUTO_INCREMENT property supported by some other databases), the Serial types already have a default implementation, but if you use them as is in Drizzle, they aren't regarded as having a default ``` type NewTest = InferModel<typeof test, 'insert'>; ^? type NewTest = {...

How to insert into a table without providing values

I've got the following schema for users in sqlite, it only contains an id, which is an auto incrementing primary key. ```typescript export const users = sqliteTable("users", { id: integer("id").primaryKey({ autoIncrement: true })...

Doent infer type in Callback syntax for query

Im querying the users table like this `db.query.user.findFirst({ where: (user, { eq }) => { return eq(user.email, whereArgs?.email); },...

Bug When Trying To Increment A Field

this set the field to 0 instead of increasing by one it used to work in other routes ``` await db .update(Artists)...

Maximum call stack exceeded with relation to self

I have the following table ``` export const category = pgTable('categories', { id: serial('id').primaryKey().notNull(), parentCategoryId: integer('parent_category_id').references((): AnyPgColumn => category.id)...

importing into schema.ts file

Hi, I am using turborepo and I have defined my schema in packages/schema/user.ts and in my main API application apps/api/schema.ts I import the user schema. I believe I have everything setup correctly in terms of package.json setup. My problem is that when using running migrations only tables explicitly defined in schema.ts seem to work. ...

What versions of MySQL are supported? I have JSON_ARRAYAGG issues with 5.7 and AWS Aurora Serverless

Can you confirm what versions of MySQL you intend on supporting? Relational queries with joins use JSON_ARRAYAGG which is not supported by earlier versions of 5.7 including AWS Aurora Serverless v1.