Drizzle Team

DT

Drizzle Team

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

Join

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

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...

Problem with ENUMs PostgreSQL

Hey all! I've been having issues with Drizzle migrate and would like some support in regards of how to fix the issue, regardless of what I do I keep getting the following: [⣻] applying migrations...error: type "activity_log_activity_enum" already exists...

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 ...