Drizzle Team

DT

Drizzle Team

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

Join

Getting results in document form rather than record

Hi, new to drizzle but liking it so far. Is there away to get the results in more of a 'document' structure? For example, I'd like to get {id: 1, user: "joe", posts: [{id : 1, title: "my first post"},{id : 2, title: "my second post"}]} rather than in record form [{id: 1, user: "joe", post: {id : 1, title: "my first post"}}, ...}]. I'm doing something like select({id ... post: {id: posts.id, title, posts.title}}). Thanks.

Unable to upgrade migrations if there are ones that do not change state but manipulate data

Hi! I have 0.16.x migrations. At some point, I needed to manipulate the data without changing the db structure, so I just made a copy of the latest migration, assigned new ID in snapshot.json and added my sql code. It worked fine, but when I moved to drizzle-kit@0.17.0 and tried to upgrade the migrations, I got the following errors: ``` Everything's fine :dog::fire: {...

require() of ES Module is not supported planetscale serverless + sveltekit

Hi, I am getting this error when I user planetscale serverless with drizzle orm ``` require() of ES Module D:\svelte-edge\node_modules@planetscale\database\dist\index.js from D:\svelte-edge\node_modules\drizzle-orm\planetscale-serverless\session.js not supported. Instead change the require of index.js in D:\svelte-edge\node_modules\drizzle-orm\planetscale-serverless\session.js to a dynamic import() which is available in all CommonJS modules....

Applying migrations with drizzle-orm/pg-core

How would I apply all the migrations that have not yet been applied? I couldn't find any information in the docs...

What is the type for an .orderBy() parameter

Inside of a function, i have a query more complicated than this, but something like:
db.select().from(users).where(...).orderBy(asc(users.username))
db.select().from(users).where(...).orderBy(asc(users.username))
...

MySqlInsertValue<> vs typeof Table type mismatch

I've got this line of code:
await db.insert(table).values(props);
await db.insert(table).values(props);
...

Argument of type 'SQL<unknown>' is not assignable to parameter

I have the following: ```ts const projects = await db .select()...

Stream select

Hey! I'm doing a large select and I'm wondering how to stream the responses for MySql

documented types for the return of `drizzle()` and the return of `mysqlTable()`

my most pressing need is documented types: https://github.com/drizzle-team/drizzle-orm/issues/273 Specifically the 2 that are holding me up right now are how to pass a the mysql2 version of drizzle() (aka a db reference) and a model reference (the result of mysqlTable()) around through my app...

.andWhere()

I know that .andWhere() isn't a function, but I'm wondering if there's a way to start a query in one function, and return it. And then have the receiver be able to continue to add to the where clause? Something like: ```ts...

Example failed to run: `pg` does not provide an export named `Pool`

I'm trying to run the example from the README file. I made a minial version, installed pg, @types/pg, drizzle-orm and drizzle-kit and tried to run it via tsx. This is my stripped down example: ``` import { drizzle } from "drizzle-orm/node-postgres";...

how do you pass a query in a typesafe way?

Let's say i want to paginate a query, so I'm going to pass a query such as this to a pagination function
db.select().from(users).where(like(users.email, '%@gmail.com'))
db.select().from(users).where(like(users.email, '%@gmail.com'))
...

help with column builder types

As I play around with learning drizzle, I wondered if I could generate a drizzle schema from a master schema. I'm very close to being able to do that. As you can see in this repo I created: https://github.com/rizen/drizzle-icing/blob/main/user.ts The code works perfectly, but problem is that when I try to use InferModel to get the column types from my schema, I'm getting ```ts...

migration on mysql errors

I've written this migrator: ```ts import { migrate } from 'drizzle-orm/mysql2/migrator'; import { drizzle } from 'drizzle-orm/mysql2';...

error: there is no transaction in progress

I created a drizzle table: ```ts export const passwordTypeEnum = pgEnum('passwordType', ['bcrypt']); export const useAsDisplayNameEnum = pgEnum('useAsDisplayName', ['username', 'email', 'realName']);...

Having a problem just connecting with drizzle

Howdy, I just found out about drizzle and thought I might give it a try, but unfortunately I'm having trouble just getting the example working from the documentation. I've created this sample file: ```ts...