Drizzle Team

DT

Drizzle Team

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

Join

"There is not enough information to infer relation" with many to many query

Hey there, I'm encountering the following error message when trying to do a many to many query:
ERR error: There is not enough information to infer relation "locations.tags"
...

drizzle-zod 0.6.0 breaks my createSelectSchema vs 0.5.1

subject line says it. the result of createSelectSchema returns a schema that has all fields nullable. No other changes other than upgrading from 0.5.1

Issue with $defaultFn and Column Typing in SQLite

Hey Drizzle team! 👋 When using $defaultFn in an SQLite schema, it seems like column typing gets ignored during inserts and updates. Is there a plan or timeline to address this issue?

Can't upsert with onConflictDoUpdate & generatedAlwaysAsIdentity ID columns?

I've noticed the type system doesn't recognize the ID columns (since they are supposed to be autogenerated?) How would one upsert or update? The ID field is not available ```ts...

Cannot generate Typebox schema from Drizzle Enum

i just trying to do the same thing as show in the docs here: https://orm.drizzle.team/docs/typebox#select-schema so i just copy and paste this from the docs: import { pgEnum } from "drizzle-orm/pg-core"; import { createInsertSchema } from 'drizzle-typebox'...

Error: we don't support params for `sql` default values

I use a specific format for the default value for the primary key for the tables in my PostgreSQL database. In my schema file, this works: ``` export const unitOfMeasureTable = pgTable("unit_of_measure", { id: text("id")...

Filter on included relations

Hello! Hope you're all doing well! Is it possible to filter based on included relations? ``` return await this.db.query.myTable.findMany({ with: {...

drizzle-kit error: Invalid target "es2023" in "--target=es2023"

How can i configure drizzle-kit to support es2023, when i reduce version to es2022 it works but for the project we need es2023. Is there a way to do this?

Migrations against Local Turso

I am currently running a local Turso instance with turso dev. How do I go about seeding it with drizzle-kit? Here's my config so far: ```ts import { defineConfig } from "drizzle-kit"; ...

Running into some type errors with query.where

I have a massive query that grabs rows from a table called transfer_portal_entries and joins them with a couple other tables to get the players information back that is needed to populate a page. However, when it comes to the if statements around the filters, query is underlined saying ``` Property 'where' is missing in type 'Omit<import("/Users/jamessingleton/Code/Businesses/redshirt-sports/nodemodules/.pnpm/[email protected]@[email protected]@[email protected]@[email protected]_@types_oydy3vileqrvfkrrqmsazssq7y/node_modules/drizzle-orm/pg-core/query-builders/select").PgSelectBase<"transfer_portal_entries", { id: import(...' but required in type 'Omit<import("/Users/jamessingleton/Code/Businesses/redshirt-sports/nodemodules/.pnpm/[email protected]@[email protected]@[email protected]@[email protected]_@types_oydy3vileqrvfkrrqmsazssq7y/node_modules/drizzle-orm/pg-core/query-builders/select").PgSelectBase<"transfer_portal_entries", { id: import(...'.ts(2741) select.d.ts(402, 5): 'where' is declared here....
No description

Executing a query that was made with QueryBuilder

I have a pnpm workspace where the schema and some queries are defined in one subproject, but the db connection is another subproject. I want to use a QueryBuilder to build my queries, which I'd then import and execute once I have my connection. So the question is simple – how can I execute the result of a QueryBuilder using the drizzle object?...

getTableColumns() for `with`?

Hi, is there any alternative to getTableColumns() for with CTEs? If I use the example from the docs: ```ts...

Renaming Table with push

I use push for migrations, which I understand is not the most recommended way to handle migrations. I'm trying to rename a table, but the push command always asks if I want to create a new table on rename the existing one: ``` Is products table created or renamed from another table? ❯ + products create table ~ product › products rename table...

sql.raw with params array

Is there a way to create a SQL instance using something like sql.raw('select * from users where id = $1', ['user-id'])? I am not able to use string templates and I already have a Query object like {sql: "select * from users where id = $1", params: ["user-id"]} that I simply want to run.

inferInsert returns unexpected type?

Hello! I'm probably just dumb but shouldn't a schema like this ```ts export const subscriptions = pgTable('subscriptions', {...

drizzle-zod returns properties as optional and `unknown`

i'm trying to get something work with @hono/zod-openapi and i am using drizzle to manage my postgres. when i use the following, drizzle-zod seems to return unknown types for properties and I am a bit stumped... ```typescript...

Type generation for relations

Hi all. I'm doing my first project with Drizzle. I'm using InferSelectModel to type my tables, which is working well, but now I also want to generate a type for a row that I'll fetch with relations. So for example, I have this relation: ```ts export const discordMessageRelations = relations(discordMessage, ({one, many}) => ({ parentMessage: one(discordMessage, { fields: [discordMessage.parentId],...

Build a complex query

the schema: ```ts import { pgTable, text,...

Drizzle seed stuck and no info displayed

Hi all, im experimenting with using drizzle-seed to seed my db instead of using raw sqls I have a script that is basically a slight modification of the tutorial from the docs, but it seems to hand/gets stuck when I run it. Any ideas why and what I could do? There's no debug messages either so its not very helpful....
No description

Please provide required params for AWS Data API driver:

This seems to have been asked a few times, but I could not get it to work. I was facing an issue where my PgViews were not getting generated, so after not finding anything, I decided to upgrade my drizzle-orm and drizzle-kit versions. Now, running pnpm drizzle-kit up results in...