Drizzle Team

DT

Drizzle Team

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

Join

type definition for tables in customer function

I am Making helper function which need two args like ```tsx function helper(db , tables){...

New critical Build error drizzle 0.35.0 with Cloudflare

EDIT: FIXED WITH VERSION 0.35.2 Since updating from 0.34.1 to 0.35.0 i encounter this error when i try to build the project localy or on Cloudflare itself, on version 0.34.1 the issue does not exist. ```...

Question about Live Queries and when they update

From my testing, it appears that Live Queries only actually update if the main table being queried from are updated. Is this correct? So if I useLiveQuery with a large relational query that loads a bunch of nested stuff, if any of that nested stuff is updated, I won't get notified. Only if the top level table changes. I'd love to know a little bit more detail about how this all works so that I can better understand in what situations the change listener fires. Is this documented anywhere?...

[Solved] Aliasing a column

Is there any way to alias a column on a select? I mean an actual alias on the final query.. In starting to test out the new views support (amazing btw), I noticed a "problem".....

[solved] SQLite in expo with useMigrations is failing without any error (just rollback)

I just tried to add a bunch of indexes to my SQLite DB, and the migration consistently fails to apply and I'm not getting any useful error message. Anyone have any ideas or how to better debug this? `` LOG Query: CREATE INDEX person_index ON authors (url,person_id`); LOG Query:...

Error while pushing/pulling from pg DB (supabase)

``` if (column7.column_default.endsWith("[]")) { ^ TypeError: Cannot read properties of undefined (reading 'endsWith')...

[solved] useLiveQuery seems to always run the query twice

I'm using drizzle-orm in an expo app and it seems to me (with logging turned on) every instance of useLiveQuery causes the query to happen twice in quick succession. Why is this?

NULLS LAST in orderBy

I am trying to create a query and the only way i have been able to order by with nulls last is this: ```TS const rows = await db...

[SOLVED] invalid reference to FROM-clause entry for table

Hi all, I'm trying to fetch data with some joins from a postgres db. My query looks like this:...

Manual Migrations

Guys quick question, I've migrated some of the migrations manually by running the SQL queries, how do I update the __drizzle_migrations table to match the current state? so that I can use npx drizzle-kit migrate...

Help with 'in' queries

Hi - sorry if this has been asked, but it's kind of hard to search for! If it helps, I'm using cloudflare's D1 database (sqlite). What I'd like to do is the following query:...

Can't create relation between two tables

I'm trying to create a relation between a clients table and a sheets tables where a client can have multiple sheets linked to their ID, but I keep getting complaints about incompatible foreign keys due to my bad schema Fixed; for anyone wondering, instead of using references(() => clients.id) very shallowly you have to create proper relations like such: ```ts...

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './connect' is not defined by "exports"

Hi, i have a strange error. I installed sqlite and drizzle, but cannot make drizzle work. I have this strange error....

Extend/omit from table schema.

Let's say I have this schema. ```ts export const users = pgTable('users', { id: serial('id').primaryKey(), email: varchar('email', { length: 255 }).notNull().unique(),...

Error: ... not assignable to parameter of type SelectedFields

I am trying to build a wrapper around drizzle select and this is being hard to achieve. What do I want? I want to create a wrapper that receives a where clause and SelectedFields, but I want the type-safety in order to suggest only valid columns to the user. I have something like this: ```typescript get<TWhere>( where: SQL<TWhere>,...

transations

Greetings! I am trying to perform 2 inserts to my SQLite db, but I want that if one of the 2 fails, it will revert any changes made to it. I then decided to use a transaction. My goal is to achieve that when inserting an account, a user is then created and associated with it. But I get an error when executing this function.
No description

Help with the connection between Drizzle and Supabase

Good afternoon!! Could anyone help me with the connection between Drizzle and Supabase in a Remix application? I'm having trouble getting it to work.
Thanks in advance!...

reusing placeholders

Is it possible to reuse placeholders with the same value instead of passing them to the driver every time they're referenced? Simply giving them the same name doesn't seem work. Drizzle creates a separate SQL parameter for each placeholder regardless. Example...

Error with drizzle-kit push

`node:internal/modules/cjs/loader:1251 throw err; ^ Error: Cannot find module 'drizzle-orm/casing'...