Drizzle Team

DT

Drizzle Team

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

Join

Text array column in sqlite

How do I create the "status" column, which is a text array in a type-safe way: CREATE TABLE IF NOT EXISTS "message" ( "name" varchar, "status" TEXT[] NOT NULL,...

non-SQL code in RQB extras

here is the custom fields doc for relational query builder: https://orm.drizzle.team/docs/rqb#include-custom-fields i would like to have an "extra" field in my query that is generated via plain typescript, not sql. so, something like: ```js const threads = await db.query.dmThread.findMany({ where: or(eq(dmThread.userA, locals.user.id), eq(dmThread.userB, locals.user.id)),...

Unable to use Drizzle SQLite proxy with snake case

I've got two drizzle clients within my electron application. Drizzle client 1: The main client with access to the local SQLite database. Runs using NodeJS from the electron part of the app. Drizzle client 2: Proxy client to run queries from the frontend by interacting with the electron process through IPC....

Major overhaul of schema for tables not really used, but ran into issues until I dropped a table

So I merged in some changes to my default branch that were contributed by a buddy of mine. I want to apply these changes to my production db. The person contributing tested things locally and everything worked out just fine. However, when I ran drizzle-kit push locally on my local DB I ran into an issue ``` PostgresError: foreign key constraint "weeks_season_type_id_season_types_id_fk" cannot be implemented at ErrorResponse (file:///Users/jamessingleton/Code/Businesses/redshirt-sports/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:794:26)...

Typescript util types to show `with` relations

Hi there Are there some TS util types to show the result of a query using with relations? For example: With<User, 'organization'> is equivalent to (User & { organization: Organization })[]...

Use only pg lib without mysql, gel etc…

Hello, i want to use drizzle with only pg on my project, but on the build it returns me errors if i dont install mysql and gel and other sql libs, how can I do if i dont want to use skipLibCheck in the tsconfig.json ? Thanks !

How to import drizzle-zod schemas on the client

Is it possible to import drizzle-zod generated schemas onto the front-end? I've tried a few setups, but always get a vite error

Drizzle not creating tables

I am using the Drizzle hook const { success, error } = useMigrations(db, migrations); My project uses expo-sqlite database. I notice that on app first launch if my database and tables setup correctly on simulator. However when I build for real device expo preview build the database tables never get setup. I exported schema. Everything workss correctly for simulator just not on real device. I was testing on iOS

Sqlite migration failing

When I add a new column to a table in typescript schema Run generate command then migrate. The migration fails because the query tries to copy newly added columns from old table to new table. ```...

Migration Error using Expo SQLite

I'm getting this error when I try to run migrations: `` DrizzleError: Failed to run the query 'CREATE TABLE offline_entries_table ( id` text PRIMARY KEY NOT NULL,...

Drizzle ORM: Does `.references()` Automatically Infer Relations for Query API or Is Manual `relation

I'm trying to understand the exact relationship between the references() method and relation definitions in the Drizzle ORM. I've noticed some discrepancies between the code requirements and what Drizzle Studio displays. Here is my original schema code without any explicit relations: ```ts...

Filter items by field on relation using query format

Lets say we have table posts that is many to one to a profile: const posts = await db.query.posts.findMany({ with: { profile: true,...

Correct way of using "attachDatabasePool" from "@vercel functions"

Vercel introduced a way to share connection pool recently. Does someone know if we can just attach it like shown in the docs and the connection release will be handled correctly with the pool? https://vercel.com/guides/connection-pooling-with-functions...

How can I extract the from/join parts of a complex query into a variable?

Hi 👋 I'm wondering how I can extract those parts for a query, so I can reuse it: ```ts...

Error: unexpected typerealtime.user_defined_filter

A few hours ago it was working great, but now Drizzle Studio throws the error Error: unexpected typerealtime.user_defined_filter . The code shown is c20918dad7074ecb80a78e737e493fff, any ideas?

Issue w/ Studio

```Unexpected error happened 😕 96f27d4cfe8f409d97c7087e06ed7e58 ...
No description

Randomly losing types for tables.

I have a mono repo setup for a bill tracking project, it's OSS so you can view it at https://github.com/sungmanito/mono -- part of the monorepo are shared drizzle definitions because I end up using them in more than one place (https://github.com/sungmanito/mono/tree/main/packages/db) Currently I've lost types for my queries. This is not the first time this has happened, but previously the culprit was that I had upgraded the drizzle-orm version in one package without updating the other(s). Each of the packages and apps are using drizzle-orm 0.44.2, confirmed in my pnpm-lockfile that there are no other listed versions. In the main web app I create a drizzle client:...

mysql bigint columns relational query loses precision

The products ids are correct but prices ids are wrong. Already have supportBigNumbers: true,...

Commercial cooperation

We want to use Drizzle Studio for commercial purposes, just like replit and neon. Who can we contact to discuss commercial cooperation and how much does it cost?