Drizzle Team

DT

Drizzle Team

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

Join

ERROR [unhandledRejection] connect ECONNREFUSED 127.0.0.1:60589

I use a drizzle-http-sqlite proxy to connect to my remote D1. After a while it hungs with this error. My issue is that I'm not connecting to a localhost so I have no idea why it happens. This is my proxy: ```js import { drizzle as drizzleProxy } from 'drizzle-orm/sqlite-proxy'; ...

error: cannot use column reference in DEFAULT expression

in this schema: ```ts export const courses = createTable('courses', { id: text('cuid').primaryKey().$defaultFn(() => createId()),...

Property 'userTable' does not exist on type 'DrizzleTypeError<"Seems like the schema generic is.. ">

I am trying to run a filter and I am getting this error, PFA https://github.com/Boby900/lucia-demo...
Solution:
Hey @Boby It seems to me that you've not passed your schemas to the function call while create the db instance like following `` import * as schema from "./schema";...
No description

Is it possible to return has many relationship load to return a single object instead of an array.

```ts db.query.products.findMany({ orderBy: (model, { desc }) => desc(model.createdAt), with: { discounts: {...

Is session table created or renamed from another table?

when I am running db push I get this error and when I am trying to create a new table named session instead of renaming it I am not able to enter and proceed with creating a new one at my terminal. It's not doing anything when I am hitting enter when the cursor is on create table any assistance would be so helpful....
No description

Wrong migration SQL generating

I'm getting wrong migration SQL when running drizzle-kit generate. The main error you can find in the questions table, it's missing so many fields.

TypeError saying `id` doesn't exist in table?

I created a user table that gets some data from Clerk inserted or updated accordingly. However, when doing ```ts await db.insert(usersTable).values({ id: data.id, firstName: data.first_name,...
No description

use limit or undefined

const limit = searchParams?.get('limit'); const shipmentsQuery = db .select() .from(shipment)...

drizzle not showing columns

im not able to query my columns in drizzle using .query method. this is my drizzle config: ```ts import { type Config } from "drizzle-kit"; import { env } from "@/env";...
No description

D1_ERROR: near "in": syntax error at offset 153

I can't seem to use inArray with d1: ``` D1_ERROR: near "in": syntax error at offset 153 ...

just updated drizzle kit and ORM

```ts import '@/drizzle/config' //load env vars import { defineConfig } from 'drizzle-kit' export default defineConfig({...
Solution:
removed it and passed the url, its fixed now
No description

Android Bundling failed

hey everyone , i have encountered an issue i cant seem to fix , this problem started after i was trying to hash password for new created user inserted to my db , so i firstly tried installing bcrypt i than ran into some issues so i removed it from my project so i found another module to do this for me which is
npx expo install expo-crypto
npx expo install expo-crypto
but now ever since ive been getting this error
The package at "node_modules\dotenv\lib\main.js" attempted to import the Node standard library module "path".
It failed because the native React runtime does not include the Node standard library.
The package at "node_modules\dotenv\lib\main.js" attempted to import the Node standard library module "path".
It failed because the native React runtime does not include the Node standard library.
, i also cleared my expo cache using
npx expo -c
npx expo -c
that also didnt fix my issue so now im just stuck ...if theres anyone here who have faced such your help would be appreciated....
No description

How to check user input is a valid column before appending condition?

Does anyone knows the proper way to do so? ``` if (columnFilters.length > 0) { const columnWhereClause: (SQL | undefined)[] = columnFilters.map( (filter) => {...

db push error

Im getting this error whenever i try to push updated schema to supabase const onUpdate = fk4.update_rule.toLowerCase(); ^ ...

Drizzle runner doesn't work but SQL does

I'm using Supabase Postgres and I can't run any queries with the drizzle runner. I just get invalid drizzle query In my console, I get the error SyntaxError: Identifier 'realtime' has already been declared When I look at the schema tab, it has a bunch of values that I haven't defined in my schema.ts file (I made sure to migrate my db). ...
No description

How to query many to many? Are the docs out of date?

I've got two tables... Events and Drinks. Each each event can have multiple drinks, and a drink can be in multple events. So I've setup a many-to-many relation as per the docs. (https://orm.drizzle.team/docs/rqb#many-to-many) schema: https://gist.github.com/magicspon/b52863a5f3b8660665e9f36d327b8cc2 ...
No description

Map/transform selected column

Is it possible to transform a column value when we define the select? This would be super useful for when sharing a subquery as I could cololcate the transform code with it instead of having a seperate transform function. Something like: ```ts db.select( isDeleted: item.deletedAt.map(date => date !== null)...

How do I use Drizzle with Supabase an Expo?

Iโ€™m trying to figure out how to use Drizzle with Expo React Native and Supabase. I know thereโ€™s a package thatโ€™s made for Expo but itโ€™s for ExpoSQLITE. Could I install the regular drizzle package and set it up normally for Supabase? Or would that make my app vulnerable because all the queries are happening locally on device. Thanks in advance...

How to get Cloudflare D1 meta information?

Hi all, is there any way to get meta information from executed query? See the attachments. https://developers.cloudflare.com/d1/build-with-d1/d1-client-api/#return-object...
No description

Drizzle Push to Turso fails on third attempt

If I use drizzle push on an empty turso db the first push works fine. (command: "pnpm db:push") After that if I run push again, it thinks that the schema doesn't match and it applies some changes. On the third db:push attempt it tries to do the changes again but this time it fails and it leaves the db in an "broken" state. (Because It has some _old tables left and the new ones are missing the values of the _old one.) I see two issues here....