Drizzle Team

DT

Drizzle Team

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

Join

Is there a way to make Drizzle work with Tauri?

I would love to have type safety in Tauri in my app but I didn't find about it... https://github.com/manga-you-know/desktop this is my app btw...

pg: syntax error at or near $1 for select distinct on

I have a postgres database, and I have a select distinct on query I am generating with drizzle code. It used to work just fine, but sometime in the last couple of months it just stopped working and started throwing errors. I haven't changed my dependency versions for drizzle or related libraries.. maybe something changed underneath the drizzle-orm deps? I am stumped ```ts...

how do i setup a minimum length drizzle schema for sqlite

any advice is appreciated, sorry if it's a dumb question but this is my first time setting up a db or even using one, i looked it up and couldn't find anything also where can i find out more about the datatypes or methods for schemas for drizzle?

Multi-branch development

Hoping to get some discussion on this issue https://github.com/drizzle-team/drizzle-orm/issues/1221. How are people managing drizzle migrations when working with multiple team members? Ideally version numbers would be a timestamp so they don’t conflict.

Versatile functions with transaction support

Used to be able to add tx = db as the last argument of a function. I find I'm no longer able to do that. Is there an updated pattern I should use if I want the ability to use any query I've already written inside of a transaction?

Issues from a WITH clause (CTE).

I have the following postgreSQL schema: ```js export const price = pgTable("price", { id: uuid().primaryKey().defaultRandom().notNull(),...

Issues with query

I am having an interesting issue with a query of mine. To start my schema looks like this: ```ts // Caregiver-specific information export const caregivers = pgTable('caregivers', {...

Unable to connect to Supabase in Development: SSL Error

I've been searching through the drizzle docs, github issues, and this help thread and still have not been able to find any way to connect Drizzle with Supabase. I get SSL-related errors every time I try to use drizzle-kit push. When I use the suggested configuration in both the Supabase and Drizzle docs I get this error: Error: SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing When I add { ssl: 'require' } in my drizzle.config.ts or add ?sslmode=require to the end of my database url I inevitably get this error: Error: self-signed certificate in certificate chain...

Non hardcoded strings in sql()

This: ```typescript import { sql } from 'drizzle-orm'; import { check, int, sqliteTable, text } from 'drizzle-orm/sqlite-core';...

explain analyze to find indexes is a hassle

I'm sure I'm missing something, but is there not an easier way to get my queries EXPLAIN ANALYZE'd ? Logging the queries includes dollar signs to be interoplated, so they cannot be EXPLAINed directly. What I'm really after is a helper to tell me what indexes I need....

Possible bug in kit when using magic sql

I've found what could possibly be a bug in drizzle-kit, but before I file an issue, I wanted to check if anyone else has had this issue: I have a column such as
created_at: timestamp("created_at").default(sql`CURRENT_TIMESTAMP`).notNull()
created_at: timestamp("created_at").default(sql`CURRENT_TIMESTAMP`).notNull()
...
No description

migration file naming convention

Hi there. When working with a team on a project that involves database migrations, it's common to encounter conflicts with migration file names, especially if the naming convention involves sequential numbers like 00003_random_text. how do you cope with that? is there a way to contol generated file name to add timestamp? is it ok to have 2 migration file with the same index?

weird __drizzle_migrations row id (move from `drizzle-kit push` to `drizzle-kit migrate`)

tl;dr: how is the starting id defined when running drizzle-kit migrate? i though it was the migration filename id but it doesn't seem to be. i had to forego the described challenge in the title. seemed trivial, but i found a few pitfalls in the dx. i tried to manually create the rows in the drizzle table but the it's unclear how the index is defined. i had 10 migrations: locally, the id started in 25. in my remote db, it started in 4....

(Async) Transactions & SQLite

The docs at https://orm.drizzle.team/docs/transactions suggest using both await db.transaction() and an async callback function, which seems straightforward. However, SQLite discourages the use of async callbacks for documented reasons. As of better-sqlite3 version 11.10, using an async function triggers an exception. What is the recommended way to handle transactions with (better-)sqlite3? Any hints would be appreciated....

Seems like the schema generic is missing - did you forget to add it to your DB type?

Hi, I am trying to use Drizzle in a multischema setup. The docs say to make the config and then create the db adapter. I would assume that the folder I set as schema in drizzle.config.ts would automatically pass it to the db client. But I get
Seems like the schema generic is missing - did you forget to add it to your DB type?
Seems like the schema generic is missing - did you forget to add it to your DB type?
. Do I have to explicitly define all the schemas I'm using in the db client like: export const database = drizzle(sqlite, {schema1, schema2}) , or is there something wrong? The way it seems in the setup for the docs, all I need is to define the schema folder and the db() should gather the types from it automatically. ```import { defineConfig } from "drizzle-kit"; export default defineConfig({...

Bug: Count in Extras (Relational)

Trying to use the example from: https://orm.drizzle.team/docs/query-utils#count ```const results = await context.db.query.label.findMany({ extras: { postsCount: context.db.$count(danceLabel, eq(danceLabel.labelId, label.id)).as("postsCount"),...

TypeError: colBuilder.buildExtraConfigColumn is not a function

hey I am building with a Sveltekit + hono + drizzle (with supabase postgres) currently and I ran into this problem after I modified my users schema to this: export const users = pgTable('users', { id: uuid('id').primaryKey(), username: varchar('username', { length: 50 }).notNull().unique(),...

How to infer connection type in TypeScript?

I'd like this function can receive transaction connection from another function, or can use normal db connection as default, so how to define type for this parameter?
No description