Drizzle Team

DT

Drizzle Team

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

Join

Migration Halts

I was working on Migrating a .sql file that I sucesfully generated with drizzle generate. The issue I ran into was that the Migration process has been running for several minutes. The .sql file is pretty lightweight and does not contain too much sql. ```javascript -- generated sql import { pgTable, serial, text, varchar, timestamp, uuid } from "drizzle-orm/pg-core";...
No description

drizzle-kit libsql extensions

hi. i want to ask if it is possible to add the extensions to drizzle-kit's libsql, mainly altering existing columns on tables. the issue is that drizzle-kit generates a migration with a generic message, where it doesn't specify which columns have changed so i can't even alter the columns myself. is there a way to add in an implementation of altering columns so that drizzle can use it, or at least getting drizzle to log the change that should be performed so that i can write the query myself? ``` /* SQLite does not support "Creating foreign key on existing column" out of the box, we do not generate automatic migration for that, so it has to be done manually Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php...

[Turso] Undefined primaryKey on push

How can I migrate a schema using Turso (libsql)? When I run drizzle-kit push, I get this error: Cannot read properties of undefined (reading 'primaryKey') I have also tried to introspect and generate the new SQL script, but I get this error: LibsqlError: SQL_NO_STATEMENT: SQL string does not contain any statement. Is there a way to fix this? Not sure what I should do as a first-time drizzle user...

Joins with results in arrays

```ts const fetchedOrderServices = await tx .select() .from(orderServices) .where(eq(orderServices.orderID, order))...

query with

``` // schema export const usersTable = sqliteTable("users", { id: text("id").primaryKey(), username: text("username"),...

Issue with drizzle-graphql Entities Not Working Well with GraphQL

Hello Drizzle Team, I'm facing challenges integrating drizzleEntities with my GraphQL schema, particularly when extending or manipulating types. Using getFields() to spread fields from drizzleEntities.types.UsersItem results in errors like: ```...
No description

Help Needed: Error with Arguments in GraphQL Resolver Using Drizzle ORM, Serverless, and TypeScript

Hi Drizzle Community, I'm running into an issue with GraphQL and Drizzle ORM while working on a serverless project using TypeScript. I've set up my environment with the following key components: - Environment: Serverless Framework...

conditional unique constraint

I want each person to have only one primary phone number, but also have as many as they want non-primary phone numbers ```ts export const personPhone = pgTable( 'person_phone', {...

Help Needed: `UnhandledSchemeError: cloudflare:sockets` with Drizzle ORM and `runtime = "edge"`

Hi Drizzle community, I'm running into a problem while trying to deploy my Next.js API routes using Drizzle ORM with PostgreSQL. Everything works fine locally, but when I set export const runtime = "edge";, I encounter the following error during compilation: ```...

cannot generate a migration file.

Hello everyone I am trying to use drizzle-kit for my project. I am using Next JS and postgres-sql database which is running in the docker container. when i run npx drizzle-kit generate it gives me No config path provided, using default 'drizzle.config.ts' but it doesn't create any migration file nor gives me any error. i have attached image of my drizzle.config.ts and schema.
No description

Create a schema but hide from push, migrate and generate

I'm using with Supabase, and I would like to add some schemas from supabase, but I don't wanna include this at push, generate and migrate. I know the filter tables and schema work for push, but I think do not work for all this....

Delete an item from an object

I want to get rid of the password in user records. How to delete the password from a user record?...

Is there more elegant way to infer enums?

This works: type TransactionReason = (typeof transactionReasonEnum)['enumValues'][number] But I wonder if Drizzle happen to have built-in way to infer TypeScript union from PostgreSQL enum....

seed

I'm trying to create a seed script, but I haven't been able to do it and I get an err that I don't see any sense in, could you help me?
No description

problems with config file dialect for PostgreSQL

versions: drizzle-orm: 0.32.2 drizzle-kit: 0.23.2 I have something like this for my config file:...

Properly setting timestamp column

I just want to make sure that I am properly setting the timestamp to match some data that I am getting. This is what my schema looks like: ```ts export const weeksTable = pgTable( 'weeks',...
No description

table with multiple possible one-to-many relation, but not many-to-many

I have an image table which looks like this, it has many possible one-to-many relationships, ie. room, profile and feedback can have many images. ``` export const image = pgTable('image', { id: guid('id').defaultRandom().notNull(), imageUrl: varchar('image_url', { length: 255 }).notNull(),...

Upgrading from drizzle-kit 0.21 ~> 0.24 didn't work, had to revert

Hey folks! Love the software, but wanted to flag a sharp edge I ran into recently. Upgraded drizzle kit, ran "generate" and got "snapshot is not of the latest version... run drizzle-kit up". drizzle-kit up seems to need an actual database connection, which was suprising. I run postgres locally in development but then there's a server as well, so this step made me nervous. More specifically, it feels like the generated migrations should stand alone without any particular server version. Am I missing something? Again, love the software, so happy to step through any of this if it's helpful. In the meantime I'll just pin my version and try again in a few releases....

⚠ Error - Top-level await is currently not supported with the "cjs" output format

I am trying to migrate to mysql database. I have already defined the schema and generated the migration files. But I try to migrate, I am getting this weird error - ```js PS D:\Typescript\drizzle orm\drizzle_test> npm run db:migrate
drizzle_test@0.1.0 db:migrate...