Drizzle Team

DT

Drizzle Team

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

Join

npx drizzle-kit pull: pg driver but getting a `'./gel-core' is not defined by "exports"` error

g'day from Aus, I'm using drizzle for the first time. I have followed along with the doco: in as much that i have copy n' pasted my way through it. I tried to use pull to generate my schema definitions...but get an error about the gel-core subpackage not being exported. here is my config. ```import { defineConfig } from "drizzle-kit";...

Do we have a way to connect to sqlite-cloud?

I saw them as one of the sponsors in the right hand side in the docs of drizzle So I gave them a visit and they look really neat Anyone knows how I could connect to their cloud isntance using drizzle ??...

TypeScript suddenly not working anymore

So I was refactoring my Project, to be able to share Drizzle/DB code between two NestJS APIs - so far working fine. But when pulling over the parts of the code that updated data in tables, I started noticing problems: ```ts export const userBusinessDetails = mysqlTable("user_business_details", {...
No description

neon database is not working

when i am opening my database it is opening but the table tab is not opening a error is coming in that. It was opening a few hour ago but not now and i have not done any changes in my any code Plz someone help me with this...
No description

Migration not setting DB column to NOT NULL

when I update my schema to set a column to use .notNull().Default("whatever") the migration files don't actually update the DB to alter the column to NOT NULL with a DEFAULT set. We are using the standard generate approach in drizzle-kit. Any ideas what we are doing wrong?

Running db.execute on the read replica?

I have some code (see next message - ran out of characters). It uses the db.execute to run the command. Currently when it executes it runs on the primary instance: ```...

Column name `as string`, needed for performance?

I joined my first project with drizzle about a year ago. I noticed that all columns definitions were including as string or as const after the name. When I asked about it I was told this was needed for performance of the type system, and they didn't go into too much detail about it. Is that true? are these casts needed for the TS server to be able to keep up with all the types gymnastics in the library? Or can we safely remove them already?

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...