Drizzle Team

DT

Drizzle Team

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

Join

Drizzle-Kit pushing not respecting enum changes?

Does drizzle-kit push not respect enum changes? Currently dealing with something that makes development annoying :( I have this enum in my schema and when I add, edit, or remove enum values it won't push to the database because existing values in the database contain them e.g. "messageEdit" already exists ```ts export const actionLogTypeEnum = pgEnum("action_log_type", [...

Some tables aren't typed (type any)

For example heres one table: ```export const orgTheme = pgTable("OrgTheme", { id: text().primaryKey().notNull(), orgId: text().notNull(), name: text(),...

Catching Multiple Constraint Error

In my current code, i tried to catch errors thrown by Libsql. ```ts try { await db.update(student).set(form.data).where(eq(student.id, form.data.id));...

Using drizzle-zod on zod-based form

Hey guys, just wondering if you have a clean solution to implement useAppForm schema and reuse drizzle-zod exposed schema. I'm constantly facing null vs. undefined and troubled to find a clean way to reuse select schema. ```...

Querying a table with a timestamp returns an incorrect time

Hi there, i'm using drizzle with a postgresql database. In one of my tables i have a timestamp. When a row gets created, the value is stored correctly in UTC time. However when I query the same row, the returned date object has an incorrect time (likely adjusted for my timezone) however it should be in UTC. table: ```ts export const sessions = pgTable("session", {...
No description

how to pass array of ids as placeholder

hello there.... why this query works ```ts await db.query.productTable.findMany({ where: (fields, o) =>...

How do i migrate when im altering a table

Hey im getting error that table already exists alhough im not even touching it
No description

Question about default values for timestamp

Currently in my db I am doing (setup a year or so ago) ``ts createdAt: timestamp('created_at') .default(sqlCURRENT_TIMESTAMP`) .notNull(),...

Unknown relational filter field: "decoder"

I am on relation queries V2, i get this error, with no further help message as to what is this or where does this come from? is it something with defining relations?...

"__drizzle_migrations AUTO_INCREMENT gap + missing entry after PlanetScale branch promotion"

We're using Drizzle with PlanetScale and encountered a migration failure caused by two issues during branch promotion. The Problem: - Migration 0026 failed with: Table 'video' already exists - The table existed but migration wasn't tracked in __drizzle_migrations...

Programmatically create database tables from schema

Is there a way to tell drizzle to just create all of the tables from my schema? I don't need the full drizzle kit migrations setup because I'm using SQLite for a read-only data store so whenever the schema changes the database is going to be fully recreated anyway. If I need to make my script create the tables, how could I go about generating the table creation queries from the drizzle schema?
Solution:
this seems to work ```ts import { generateSQLiteDrizzleJson, generateSQLiteMigration } from "drizzle-kit/api"; const migration = await generateSQLiteMigration(...

(drizzle-typebox) 'id' missing when using `generatedAlwaysAsIdentity`

When generating a select schema from my drizzle table, the id field uses generatedAlwaysAsIdentity and is missing from the schema. I see that using generatedByDefaultAsIdentity() instead fixes this (https://github.com/drizzle-team/drizzle-orm/issues/4724) but I would need to evaluate any consequences before rolling this out to production. Any help or insight would be appreciated! Update: rolling drizzle-typebox back to v0.3.0 (from v0.3.3) seems to fix for now...

drizzle-kit pull not working (freezes) with supabase

I'm trying to integrate drizzle to an existing supabase project with 77 tables. When i run npx drizzle-kit pull i see this log ```...

Drizzle studio not working

my schema is migrated to db but this error comes everytime I run the studio command
No description

Drizzle Studio jsonb column showing [object Object]

DB: postgresql 1. Array of objects are stored in json column. 2. It shows [object Object] when I double click on the column to inspect. ...
No description

Drizzle Studio Fails to Connect to SingleStore

I'm using a SingleStore database and everything works smoothly when interacting with it through the Drizzle ORM in my code. However, when I try to connect the same database to Drizzle Studio, I get the following error: Table 'information_schema.check_constraints' doesn't exist Has anyone encountered this before?...
No description

Select statement with dynamic fields

Hello I'm writing out this because I don't get how I'm supposed to pass a subset of a given table's fields to a select() statement. I would like to do something like this: ```ts getUserById(id: number, fields: ??? = ['*']) => {...

Is this a good practice for joining data in Drizzle? Should I use SQL or handle it in JS?

Hey! I'm building an app and, to be honest, I'm not super strong on the backend side, but I’ve been given this task as a full-stack developer. The app has a main table called car_formula_colors. Each formula can have: Multiple car models...

Multi dialect CRUD lib

Hi 👋 I am attempting to develop a multi-dialect CRUD library that enables the execution of CRUD operations for various databases, including PostgreSQL, SQLite, MySQL, and others. However, unfortunately, drizzle-ORM is structured in a manner that prevents me from implementing even a basic prototype that includes a create method that supports all databases and ensures complete type accuracy. Could any team member assist me in initiating this project?...