Drizzle Team

DT

Drizzle Team

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

Join

I messed up my supabase and drizzle setup

To start off, databases and ORMs I am not super familiar with and didn't realize I was just directly running migrations against the production db 🙃 so after chatting with some folks I decided to install docker and run pnpm supabase start locally and that ended up failing due to ``` ERROR: column "class_year" cannot be cast automatically to type integer (SQLSTATE 42804) At statement 1: --> statement-breakpoint ...

drizzle-postgresql migratin error using nestjs framework

hello guys can you help me with this when ever i try to migrate i get like this error but drizzle-kit generation work why is this migration is not working ?
No description

im getting problems with drizzle schemas

Hi everyone, I'm having a problem with the schemas, they all work except for transportistShema. If I add this one, I get the error TypeError: Cannot read properties of undefined (reading 'Symbol(drizzle:Schema)') ```js...
No description

Defining nested types with Drizzle Zod

What would be the correct way to create nested types with drizzle-zod here? I have an acccount table like this: ```ts...

Drizzle Kit Generate renames columns incorrectly

I am running a drizzle-kit generate. It appears to think I added/renamed a column on all of my tables that does not exist. Any help on how or why this is happening would be appreciated!
No description

drizzle-typebox infers integer() as TString

I've tried it on Github Codespaces and my machine, both times the types are inferred wrong. Is anyone else dealing with this? Here's the code: ```ts import * as t from '@sinclair/typebox'; ...
No description

Too many nested objs on many-to-many relations

I get an object like ```js [ { "id": "43119ea8-a293-4c89-aaba-4d699f89e34f",...

Can't seem to $count in multi relation query

I trying to get the count of "clicks" from a table 2 relations deep. Querying for posts by a creators id, getting each posts link for a given guild id, and counting a clicks table tracking clicks for a given link. I can't for the life of me find a nice way to do this in drizzle any assistance would be helpful! ...

Timestamp IS NULL on where condition returns "status": "success"

Hello, I cannot understand the result is altered when I put a condition on the timestamp....
No description

How to set opclass for index with custom sql column

we do have following definitions, after we used drizzle-kit pull
uniqueIndex("sap_id_upper_trim_idx").using("btree", sql`upper(TRIM(BOTH FROM sap_id))`),
uniqueIndex("sap_id_upper_trim_idx").using("btree", sql`upper(TRIM(BOTH FROM sap_id))`),
...

Column of relation already exists

I have a couple of tables ```tsx export const schoolReferences = pgTable( 'school_references',...

Select without from?

Is there currently a way to use a select without from, or a raw sql query as a subquery? Basically, I need to do the example from this issue: https://github.com/drizzle-team/drizzle-orm/issues/372...

How to add schemas to the DB object when using URL for DB connection

I'm using a URL to connect to my database and I cannot figure out the syntax for adding schemas to the DB instance This is how my config looks ``` import { drizzle, } from "drizzle-orm/mysql2"; import * as schmea from "../drizzle/schema.ts";...
No description

_meta Directory purpose

I'm having trouble with understanding what is _meta directory and how I should approach it. What is it's purpose? Should I check it into the repository? What is the purpose of snapshots? Is there any way to rollback a migration?...

Drizzle Graphql with graphql codegen for apollo in the frontend

Is there any wait to get all the ".graphql" queries and mutations auto generated for inputing on graphql codegen for frontend typescript? I mean, i want to get all queries and mutations already generated by drizzle graphql schema, in the graphql codegen for react/next. There is anyone can help with it please?...

d1-http explanation

I stumbled accross the https://orm.drizzle.team/docs/guides/d1-http-with-drizzle-kit driver. I could not figure out how to use it, in terms of how to retrieve data. After setting it up how can i access the client?

Reconstruct Queries from toSQL() data

Hey everyone, I have an interesting use case. I'm trying to figure out if there's a way to reconstruct/run a query from a Query object obtained via query.toSQL(). Something like: ``` ts const query = db.select().from(usersTable).limit(1); const sql: Query = query.toSQL();...

[Solved] Running drizzle-kit push in CI to set up a database

Hello, I'm trying to run drizzle-kit push in a CI pipeline to prop up a database for testing. However, the process gets stuck on "Warning You are about to execute current statements". Obviously there is no tty and no user to answer yes. I checked drizzle-kit push --help and didn't find any --yes or --ci arguments to skip this check. What's the recommended way to proceed here?

Not getting a typescript error for insert

```typescript import { db } from "./db"; import {users} from "./schema"; // gives no error, but it should ??...

How to apply "where OR condition" and "lt or gt condition" on timestamp fields

Hello, i woud like to apply 2 conditions: - OR condition - if basketItem invoicedOn is newer than basketItem InvoicedOn with 1 hour added to it...
No description