Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
32 views

drizzle-kit not using .env.test or .env.development in bun.js

I'm working with bun.js and I'm trying to do bun run drizzle-kit push, bun run drizzle-kit generate, bun run drizzle-kit migrate but no any of these commands works, the drizzle cannot get my ...
Anas's user avatar
  • 1,777
1 vote
1 answer
50 views

Pg - Next js 15 Module not found: Can't resolve 'fs'

I am using next js 15 and drizzle orm. I have just added drizzle and setup the boilerplate and when i run it i get this error. Error: GET /_next/static/webpack/f2b54d6051787b9b.webpack.hot-update.json ...
Atuhaire Collins's user avatar
0 votes
1 answer
24 views

drizzle orm useLiveQuery doesn't detect parameters change

I am using drizzle orm for sqlite with useLiveQuery. Habits are returned and then based on habits ids I want to fetch tasks. But I always get 0 results. If I pass directly [1,2] I get result. It looks ...
1110's user avatar
  • 6,809
0 votes
2 answers
30 views

TypeScript type error on my servfer action next.js

need help on a server action on my Next.js applicastion, giving me a type error and can't pinpoint the reason, it appears when there are 3 values on the db.insert for the orderProduct and it always ...
Karl Cusi's user avatar
0 votes
2 answers
76 views

Mapping Query Builder Results to Nested Objects in Drizzle

I'm transitioning to Drizzle ORM from a NestJS-TypeORM background : TypeORM: Both the repository and query builder return similar structured results, making it easy to work with joined data. Drizzle: ...
BereketeAb B. Kebebew's user avatar
0 votes
1 answer
55 views

How to make a custom constraint name in drizzle orm? [closed]

How to make a custom fk pk constraint name in drizzle orm? I always face this problem : sqlState: '42000', sqlMessage: "Identifier name '...' is too long" I have tried changing the ...
Galaxy's user avatar
  • 1
0 votes
1 answer
106 views

How to Handle transaction with Nextjs 14 and Drizzle ORM

I am developing an application using Next.js 14, Drizzle ORM, and NeonDB/PostgreSQL, and I'm encountering issues when running transaction queries. Here’s a simplified version of my setup: Database ...
Dinesh's user avatar
  • 845
0 votes
0 answers
25 views

How to get a row from a table as well as the one to many relations from another seperate table using Drizzle ORM?

I have this Drizzle ORM schema for one of my Cybersecurity projects: export const ips = createTable("ips", { id: uuid("id") .primaryKey() .default(sql`gen_random_uuid()`),...
TheLawlessDev's user avatar
-1 votes
1 answer
53 views

Why do my cards stop rendering sometimes?

I'm a junior developer, and I created a drinking game, a type of "Dare or Drink." I used the T3 Create App with TypeScript, Drizzle, and PostgreSQL. The problem is that my application ...
Pedro Paitax's user avatar
2 votes
1 answer
805 views

pgTable from drizzle relations many to many is deprecated

Following the docs to create a many to many relation it suggests to create a junction or join table. The ts deprecation error is below. @deprecated — This overload is deprecated. Use the other method ...
frost2709's user avatar
  • 373
0 votes
0 answers
41 views

How can I avoid N+1 query issues when checking friend statuses in a list with Drizzle ORM?

Im using Drizzle ORM I have this code in business layer to get list of users and represent them as Friend List export const getFriendList = async (sessionUserId: number, userId: number) => { ...
Cazcade's user avatar
0 votes
0 answers
72 views

How can I log and handle database connection interruptions in a Drizzle ORM?

I'm working on a Fastify server and using Drizzle ORM with postgres-js for database interactions. I have a custom plugin that sets up the main database connection and attaches it to the Fastify ...
Nazar Duma's user avatar
0 votes
0 answers
39 views

how to define a created_at read-only columns that is automatically filled with the creation date of the record

I want to define a created_at date column in drizzle The column is ready only, so the type inferred should for this field as optional (Date | undefined) for creation. I tried with this: export const ...
opensas's user avatar
  • 63.1k
0 votes
0 answers
77 views

automatically running drizzle migrations in sveltekit on every deploy

I'm planning to use drizzle for handling persistence I'd like to run pnpm db:migrate when the sveletkit server starts if the migrations fail, server should not start (otherwise the app would be ...
opensas's user avatar
  • 63.1k
1 vote
0 answers
180 views

drizzle-kit not able to find dirzzle-orm on cli

I'm using yarn workspaces to structure a monorepo style project. I recently upgraded to yarn v4 and am running into issues with running drizzle-kit seemingly not able to detect drizzle-rom when run ...
callmetwan's user avatar
  • 1,330
1 vote
0 answers
109 views

Trouble setting up turso database with drizzle ORM

So I have a Create React App (deprecated I know) and a Turso database that I am trying to connect to. My app needs to be able to read and write and I have a function to write that looks like this: &...
Ethan Deardorff's user avatar
0 votes
1 answer
72 views

Can I do "WITH INSERT do INSERT" in Drizzle?

I have two tables, users and settings. When a user account is created, I also want to create a row in the settings table which stores the user.id The Drizzle docs mention you can do WITH subquery AS (...
ivo's user avatar
  • 1
0 votes
1 answer
119 views

NextJS Drizzle-Kit cannot use CLI

I am using the drizzle auth template and trying to modify it to add Role Based Authentication. So I made some changes to the db.ts to add in the roles import { drizzle } from 'drizzle-orm/postgres-js';...
Jack Duffy's user avatar
0 votes
2 answers
170 views

React Native Expo with Drizzle ORM and Convex: Cannot use import statement outside a module

I am using Expo Sqlite with Drizzle ORM: My drizzle.config.ts: import { Config } from "drizzle-kit" export default { schema: "./lib/db/schema", out: "./lib/db/migrations&...
Jay Sloan's user avatar
-1 votes
1 answer
257 views

Next JS server Component fetch data when using clerk for authentication and Hono js For backend

I am using next JS server component to fetch data with search params using clerk authentication package. Also, using hono JS as backend with drizzle ORM. The issue is can't fetch data in server ...
Mehdad Hussain's user avatar
0 votes
3 answers
631 views

Error: No database connection string was provided to `neon()`. Perhaps an environment variable has not been set?

After adding a new Row on my database, started to get this error, been working on this project for a month, it doesn't make any sense. Error: No database connection string was provided to neon(). ...
Matheus Raimundo's user avatar
1 vote
0 answers
167 views

How to replicate a LEFT JOIN LATERAL query in Drizzle ORM

I'm trying to translate the following SQL query into Drizzle ORM in TypeScript: await this.drizzleDB.execute( sql` SELECT i.id, i.title, iu.description, iu.last_updated_timestamp ...
Timur's user avatar
  • 362
0 votes
0 answers
227 views

Select distinct in Drizzle Postgresql

How can I make this query return distinct resources: const similarGuides = await db .select({ resourceId: embeddings.resourceId, title: resources.title, content: resources.content, ...
Nithur's user avatar
  • 129
0 votes
1 answer
52 views

Page not refreshing after task creation/update

I'm working on a Next.js project with Drizzle ORM where I can create and update tasks. After submitting the task form, I get navigated back to the homepage, but the new/updated task isn't displayed ...
Dustin Lee's user avatar
0 votes
0 answers
21 views

Database abstraction with type script support

I'm trying to implement database abstraction in my project (Honojs, Drizzle ORM, PostgreSQL) with complete TypeScript support. I'm facing an issue while passing a column name in a query to the ...
user27367455's user avatar
0 votes
1 answer
140 views

Drizzle ORM and Postgres: invalid byte sequence for encoding »UTF8« when using mutated vowels

I forked this Next.JS-Boilerplate repository which uses drizzle-orm with node-postgres. I created a database scheme export const myTableSchema = pgTable('myTable', { id: serial('id').primaryKey(), ...
Kruspe's user avatar
  • 645
0 votes
0 answers
120 views

How to use Drizzle-zod types in Nuxt?

I have a big monorepo with 3 nuxt applications that share a common server (written in Hono). The structure of my app is: . ├── apps │   ├── web1 │   ├── web2 │   └── web3 ├── package.json ├── packages ...
Nishant Jalan's user avatar
0 votes
0 answers
466 views

How do I share a Zod validation schema between backend and frontend in a pnpm monorepo?

I am working on a project using a pnpm monorepo setup. My backend is built with Hono, Drizzle ORM, and Zod for validation. I am using the drizzle-zod package to generate Zod schemas from my database ...
dingidango's user avatar
0 votes
1 answer
693 views

drizzle ORM select data from table in order of newest data

I am using drizzle ORM with my Next.js & PostgreSQL I want to get the data from the newest data to the first one (oldest) I know orderBy() could help me ! for id of my post Iam using uuid not ...
AmirHossein_Khakshouri's user avatar
1 vote
0 answers
239 views

NeonDB Fetch Error with drizzleORM: Cannot connect to neon database from Next js 14 app to fetch data but connects for mutations

I'm trying to fetch data from my db in a server component but I keep getting this connection error ⨯ NeonDbError: Error connecting to database: fetch failed at async page (./src/app/tailor-cv/job/[id]/...
Ebuka's user avatar
  • 39
0 votes
0 answers
157 views

Drizzle ORM - Typesafe JSON Returns malformed array literal

when I have a type safe json array in my schema like this: HistoricalData: json('History').$type<historyData[]>() and I try to update like this: const id = await db .update(...
Oliver Gewohn's user avatar
0 votes
0 answers
62 views

Cleanup PostgreSQL connections after `drizzle-kit push` with postgres.js client

I'm using the postgres.js (3.4.4) client with drizzle-kit (0.24.1) to run drizzle-kit push, but then I notice it wastefully leaves behind persistent connections. I know I could run a cron job to ...
Meow's user avatar
  • 1,732
1 vote
0 answers
37 views

Loading all items in searchable select from start or while typing?

I have an interesting case where I have a form for adding data to a database. I am using Next.js and a PostgreSQL database for reference. There are two select fields (where I use the react-select ...
rebellion's user avatar
  • 6,740
0 votes
0 answers
84 views

Drizzle sql operator doesn't match expect.anything() in vitest

This test expect(dbMock.where).toHaveBeenCalledWith( gte(messageFeed.timestamp, expect.anything()) ); fails for this: .where( gte(messageFeed.timestamp, sql`now() - interval '1 day'`) ) but ...
kol3x's user avatar
  • 1
0 votes
0 answers
67 views

Drizzle Expo SQLite: NOT NULL Constraint Fails on Runtime Functions

I'm having an issue with Drizzle ORM and Expo SQLite in my project. I’m getting this error: [Error: Calling the 'runAsync' function has failed → Caused by: Error code 19: NOT NULL constraint failed: ...
Adam Sucharda's user avatar
0 votes
1 answer
205 views

unique constraint with deleted_at IS NULL condition

How do I create a table with a WHEN SQL tag? I want a table like this "members_table", { id: serial("id").primaryKey(), email: text("email").notNull(), ...
Oscar Alsos's user avatar
0 votes
1 answer
15 views

Writing this switch function (typescript) from Prisma-speak to Drizzle-speak

I'm following the "Add Clerk Authentication & Stripe Payments to your NextJS tRPC Application" tutorial which uses T3 app + Prisma + Clerk. I've started my T3 app with Drizzle ORM. I ...
user26830065's user avatar
0 votes
1 answer
132 views

"Drizzle Kit Migration: PostgresError 'password authentication failed for user' during database migration"

after connecting all setup with supabase as shown in this youtube chanel text timing 1:30:30 database setup its throwing error :- > [email protected] db:migrate drizzle-kit migrate No config path ...
John's user avatar
  • 1
0 votes
1 answer
196 views

Getting error: "could not determine data type of parameter $1' when using Drizzle sql operator with template literals

I have a simple table: CREATE TABLE items ( id SERIAL PRIMARY KEY, name VARCHAR (50) UNIQUE NOT NULL, price decimal NOT NULL ); INSERT INTO items (name, price) VALUES ('sprocket1-2a', 50.0)...
tehawtness's user avatar
1 vote
0 answers
106 views

Drizzle query builder function type issue using findMany()

I'm trying to write a query builder function in Drizzle using findMany() function that handles pagination and parameter request. The issue is, i'm unable to use orderBy in "with". The ...
Optis2005's user avatar
0 votes
1 answer
342 views

how to create a query and then exec it using drizzle query builder feature

I'm working on a project using Drizzle ORM and Better-SQLite3 with TypeScript. I need to execute a query after a specific event occurs. Here's the code I have for constructing the query: const query = ...
Matheus Santos Araújo's user avatar
0 votes
2 answers
452 views

Drizzle ORM in react native expo does not show database file

I am having hard times visualizing my sqlite database , i am using react native under expo with drizzle ORM to manage a sqlite database locally , the issues is that when i run all the setup commands ...
yanis's user avatar
  • 21
0 votes
1 answer
94 views

Type inference for Nitro plugin

In my Nuxt3 application I would like to use drizzle as my ORM. I registered the DB connection as a Nitro plugin like this: export default defineNitroPlugin(async (nitroApp) => { const db = ...
Cilenco's user avatar
  • 7,037
0 votes
1 answer
74 views

How to avoid SQL fanout in this situation?

I may be incorrect in saying it's a fanout, but I think that's what it is. To start with, I'm using Drizzle ORM. Essentially, I have 4 tables in question: one is a bills table, another is a ...
hackysack's user avatar
5 votes
1 answer
805 views

Does drizzle ORM auto rollbacks when there is an exception or do I need to call tx.rollback?

I'm building an API with nestjs and drizzle. When there is an error and I need to early return and respond the Request with an HTTP error, I do: throw new HttpException('message', code); and nest ...
PortalGamesMais's user avatar
0 votes
0 answers
148 views

Await in next js causing infinite loading with no error

I'm trying to query a db with drizzle and show the results but when I await the function querying the db my app starts reloading and never stops until i remove the await. When i remove the await I get ...
haardikg's user avatar
1 vote
0 answers
182 views

Foreign key reference in drizzle causes type error

In my drizzle schema, I have two tables, users and payment_history, when I try to reference the id of payment_history, it throws a type error Function implicitly has return type 'any' because it does ...
Crade47's user avatar
  • 43
1 vote
0 answers
279 views

Drizzle: there is no unique or exclusion constraint matching the ON CONFLICT specification

import { sql, type SQL } from "drizzle-orm"; import type { AnyPgColumn } from "drizzle-orm/pg-core"; export function lower(col: AnyPgColumn): SQL { return sql`lower(${col})`; } ...
Ghyath Darwish's user avatar
7 votes
1 answer
2k views

Anyway to migrate down in Drizzle

After generate and pushing migrations I see we have the option to drop migrations in the documentation. However this does nothing to the underlying db state. Running drizzle generate again also does ...
nightwolf555's user avatar
0 votes
1 answer
292 views

dontenv.config() in nuxt 3 gives error process.cwd is not a function

I am trying to integrate Drizzle into Nuxt 3. In /server/db/index.ts I have the following import { sql } from '@vercel/postgres'; import { drizzle } from 'drizzle-orm/vercel-postgres'; import dotenv ...
PrestonDocks's user avatar
  • 5,378

1
2 3 4 5