Drizzle Team

DT

Drizzle Team

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

Join

RLS doesn't work when managing policies with Drizzle?

This is taking to long to understand and I would be grateful for some help!!! I have my schema distributed between a number of different files grouped by the table's functions/needs. All these files are in my src/schemas directory. One of these files is dedicated for policies. Nothing crazy. Something like image 1. userProfiles for example is correctly being imported βœ…, drizzle-kit check passes with flying colors βœ…, a push or a migrate call runs smoothly βœ… and everything is being created in Supabase as expected βœ…. Or so I think? πŸ€” ...
No description

Re-using a CTE and typing hell

What I really want: ``` filteredSet = db.selectDistinct().from(table).where(...) ...

Is it possible to do this transformation using `db.query`?

Hello! Can I get rid of other columns and keep only tag? ```ts return ctx.db.query.bookmark.findMany({ with: {...
No description

Why isn't the Drizzle Adapter updating my Google OAuth refresh token in Auth.js?

I'm using Auth.js with the Drizzle Adapter, and since my app is still in testing mode, my Google OAuth refresh token expired after 7 days. I have prompt: "consent" and access_type: "offline" set, so I should be receiving a new refresh token, but it doesn’t seem to update in the database. Has anyone encountered this issue before? How can I ensure the refresh token gets properly updated? Any help would be greatly appreciated! πŸ™Œ...

Unique Index Constraints with Multiple Columns

I have the following constraint in libSQL: ```js uniqueIndex('notif_unique_constraint').on( table.userId, table.sourceUserId,...

Postgres replication using drizzle orm

Is there a way to do postres database replication using drizzle orm ?

Which JavaScript library that works alongside Drizzle ORM is better for pooling, pg.js or postgresjs

I'm working on a JavaScript/TypeScript backend project using drizzle and PostgreSQL where I came across pooling for the first time. I found there are several ways to integrate pooling with drizzle ORM but they each rely on different libraries. There is the pg/node-postgres method which goes like this: ```typescript...

Generic table with specific fields

I'm trying to create a function that takes in a table that has some arbitrary columns and the columns created_at and updated_at. I want to create a generic that describes this correctly so it also works with things like drizzle-zod. The ideal solution would be something like ```ts export function createCrudSchemas<TTable extends WithColumns<AnyPgTable, { created_at: AnyPgColumn,...

Need Help!

When running 'bun drizzle-kit push' i get the following error "No config path provided, using default 'drizzle.config.ts' Reading config file '/Users/kevinchase/Documents/VS-code/react/my-app/drizzle.config.ts' Using '@Neondatabase/serverless' driver for database querying...

Using `query` with RLS.

New to Drizzle from Prisma and the hype is real. Psyched about easily using RLS. But... I am using RLS with Supabase and followed the Drizzle SupaSecureSlack example (https://github.com/rphlmr/drizzle-supabase-rls). Why is it that I can use db.admin.query.findMany.... but not do that with rls? Is there a way I can pass the rest of the client context thru the transaction? I am not sure I have enough knowledge to figure that out. Would appreciate any support!!!...

Using date object for sqlite in INSERT INTO SELECT

I'm struggling with an insert into select query in SQLite where I need to provide custom timestamp values. Here's my table definition: ```typescript export const games = sqliteTable("games", {...

Error with Expo Sqlite + Drizzle

So i try to use Drizzle with expo everything are set but i got an error ``` [Error: undefined Unable to resolve module ./0000_crazy_prodigy.sql from /Users/x/todo-expo-drizzle/drizzle/migrations.js: ...

mapWith not running in Drizzle queries (db.query)

Hello, not sure if this is the best place to post this (please let me know if I should follow-up on this issue someplace else). I believe there's a bug causing mapWith to not run in Drizzle queries (db.query) when using certain native SQL functions. SQLite example: https://drizzle.run/n509hxyyy5prp2roiyjs6em6...

Connection management with Drizzle

I'm seeing lots of examples from AI assistants that implement complex connection management like this class-based example (attached image). However, in the Drizzle docs, the setup is much simpler: ```ts import { drizzle } from 'drizzle-orm/bun-sqlite'; import { Database } from 'bun:sqlite'; ...
No description

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

Hi, I am having an issue trying to pass in data into the tables, and I keep getting this error and this message "return client.query(rawQuery, params);" Does anyone know what I can do to fix this?

Can't use `where` clause?

Hi community, I don't know why, but I am not able to use the where clause. ```typescript export const packages = pgTable('package', { id: serial('id').primaryKey().notNull(),...
No description

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

I searched and found a similar github issue that mentioned to fix this, I have to relations generated by drizzle, but I can't find any relations automatically being generated.
No description

Order by on Joined Tables

I am attempting to do an order by for a joined table ```js export const playerItem = pgTable( "playerItem",...

Issue with drizzle-kit and enums

I have an issue with drizzle-kit and enums and can't find a solution. I am trying to use drizzle with Supabase. When I run npx drizzle-kit push is when I get an error if the schema contains a pgEnum. If the database is fresh and the enum doesn't exist and I run that command the error I get is this: ``` npx drizzle-kit push
No config path provided, using default 'drizzle.config.ts' Reading config file 'C:...\Documents\Dev\JS\projectName\drizzle.config.ts' Using 'pg' driver for database querying...

How auto push schema and seed data when starting NextJS using Drizzle (with Docker)

I have an NextJS 15 app using Drizzle. ANd I would like to auto push and seed the data when starting the app. But how to do it ? I dont find any info about this... Btw there is my package.json : ```json { ......