Drizzle Team

DT

Drizzle Team

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

Join

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/drizzle-orm@0.38.2@libsql+client-wasm@0.14.0@opentelemetry+api@1.9.0@types+pg@8.6.1_@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/drizzle-orm@0.38.2@libsql+client-wasm@0.14.0@opentelemetry+api@1.9.0@types+pg@8.6.1_@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...

When using Deno, is it still needed to install the dotenv and tsx packages?

Deno already comes with first-class support for TypeScript and built-in support for environment variables.

drizzle-kit for production

I want to setup drizzle-kit for production but i cannot put db credentials for the prod db in the config file since it'll be commited to a source repository. How will I do migrations in production?

SyntaxError: Expected ',' or '}' after property value in JSON at position 54561

``` No config path provided, using default 'drizzle.config.ts' Reading config file '/Users/farhan/dev/omni-fe-v2/drizzle.config.ts' SyntaxError: Expected ',' or '}' after property value in JSON at position 54561 at JSON.parse (<anonymous>)...

TypeError: Cannot read properties of undefined (reading 'replace')

I'm switching from Option 3 to Option 2 from this document https://orm.drizzle.team/docs/migrations I used drizzle-kit push to push my new schema changes to Supabase database but got this error ``` .../node_modules/drizzle-kit/bin.cjs:20104...

New version Not use IF NOT EXIST'S anymore

At the latest version of drizzle-kit with Postgresql, when generating a new table, they do not come anymore with CREATE TABLE IF NOT EXISTS I don't know if is the expected behavior, but I didn't like! 0.30.0 vs 0.28.1...
No description