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-Seed null values

Hello there, how can I seed null values with drizzle-seed? I want something like: ```js...

Migration failed, and can't add new migration

Hello, I've tried to add a change to a table ```ts import { pgTable, serial, text } from 'drizzle-orm/pg-core'; ...

Turso drizzle-kit CLI: Passing dbCredentials via CLI options

Hi, I'm building a multi-tenant database and trying to configure drizzle-kit using CLI options. However, I’m unsure whether it's possible to pass the dbCredentials part of the config via CLI, and if so, how to do it. ``` dbCredentials: { url: process.env.TURSO_DATABASE_URL,...

Knowing when drizzle finished Migration/Pushed.

Hi, I'm new to DrizzleORM and backend development as a whole. I'm using Drizzle BetterSQLite3 with SvelteKit. I'm trying to execute raw SQL commands to create some triggers for backups. Currently, I'm doing it like this `` await db.transaction(async (tx) => { tx.run(sql CREATE TRIGGER IF NOT EXISTS TRG_CT_INSERT_BACKUP...

arrayOverlaps case insensitive

is it possible to make arrayOverlaps case insensitive in drizzle ? ```ts const fetchFromDb = async (names : string[]) => {...

Use DB functions to format data on update e.g. DATE()

Is there a way to use database functions like DATE in SQLite to format a value on update to ensure it is formatted correctly? I have a text field where I store a person's date of birth and want it formatted as YYYY-MM-DD (which DATE does) and doing it on the client side with no verification on the server / db side seems error prone. As with schemas in general it is best to constrain data as much as possible and this data should never be in any other form. Is there a way to make it so? I already have a check that it is a valid date with
check(
"date_of_birth_check",
sql`(LENGTH(${table.date_of_birth}) <= 10 AND DATE(${table.date_of_birth}, '+0 days') IS ${table.date_of_birth})`,
),
check(
"date_of_birth_check",
sql`(LENGTH(${table.date_of_birth}) <= 10 AND DATE(${table.date_of_birth}, '+0 days') IS ${table.date_of_birth})`,
),
...

Time Mysql Formatting

The Time format come formatted like hh:mm:ss.mmmmmm ( unsure if the last part is ms. Just like in the following query result: ```Js { id: 2,...

Many to Many to Many

I mean a relationship where a user can belong to many groups and in a particular group can have many roles. I am counting on quick help. Thanks in advance for your help.

Subquery within same table not working as expected

I have this table that list employees: ``` export const workersTable = pgTable('workers', { workerId: integer('worker_id').notNull().primaryKey(),...

How to store Uint8Array in postgresql

```ts const users: pgTable("user", { recovery_code: // what to use here? })...

npx drizzle-kit pull: pg driver but getting a `'./gel-core' is not defined by "exports"` error

g'day from Aus, I'm using drizzle for the first time. I have followed along with the doco: in as much that i have copy n' pasted my way through it. I tried to use pull to generate my schema definitions...but get an error about the gel-core subpackage not being exported. here is my config. ```import { defineConfig } from "drizzle-kit";...

Do we have a way to connect to sqlite-cloud?

I saw them as one of the sponsors in the right hand side in the docs of drizzle So I gave them a visit and they look really neat Anyone knows how I could connect to their cloud isntance using drizzle ??...

TypeScript suddenly not working anymore

So I was refactoring my Project, to be able to share Drizzle/DB code between two NestJS APIs - so far working fine. But when pulling over the parts of the code that updated data in tables, I started noticing problems: ```ts export const userBusinessDetails = mysqlTable("user_business_details", {...
No description

neon database is not working

when i am opening my database it is opening but the table tab is not opening a error is coming in that. It was opening a few hour ago but not now and i have not done any changes in my any code Plz someone help me with this...
No description

Migration not setting DB column to NOT NULL

when I update my schema to set a column to use .notNull().Default("whatever") the migration files don't actually update the DB to alter the column to NOT NULL with a DEFAULT set. We are using the standard generate approach in drizzle-kit. Any ideas what we are doing wrong?

Running db.execute on the read replica?

I have some code (see next message - ran out of characters). It uses the db.execute to run the command. Currently when it executes it runs on the primary instance: ```...

Column name `as string`, needed for performance?

I joined my first project with drizzle about a year ago. I noticed that all columns definitions were including as string or as const after the name. When I asked about it I was told this was needed for performance of the type system, and they didn't go into too much detail about it. Is that true? are these casts needed for the TS server to be able to keep up with all the types gymnastics in the library? Or can we safely remove them already?

RLS doesn't work when managing policies with Drizzle?

This is taking to long to understand and I would be grateful for some help!!! I have my schema distributed between a number of different files grouped by the table's functions/needs. All these files are in my src/schemas directory. One of these files is dedicated for policies. Nothing crazy. Something like image 1. userProfiles for example is correctly being imported ✅, drizzle-kit check passes with flying colors ✅, a push or a migrate call runs smoothly ✅ and everything is being created in Supabase as expected ✅. Or so I think? 🤔 ...
No description

Re-using a CTE and typing hell

What I really want: ``` filteredSet = db.selectDistinct().from(table).where(...) ...

Is it possible to do this transformation using `db.query`?

Hello! Can I get rid of other columns and keep only tag? ```ts return ctx.db.query.bookmark.findMany({ with: {...
No description