drizzle-team / drizzle-kit-mirror

Docs and issues repository for drizzle-kit
290 stars 17 forks source link

drizzle kit studio not working #496

Open mahmoudesmaill opened 2 months ago

mahmoudesmaill commented 2 months ago

I have a simple schema file

`import { mysqlTable, int, varchar, text } from "drizzle-orm/mysql-core"; import { relations } from "drizzle-orm";

// Users table export const users = mysqlTable("users", { id: int("id").primaryKey().autoincrement(), name: varchar("name", { length: 255 }).notNull(), });

// Posts table export const posts = mysqlTable("posts", { id: int("id").primaryKey().autoincrement(), content: text("content"), authorId: int("author_id") .notNull() .references(() => users.id), });

// Define relations export const usersRelations = relations(users, ({ many }) => ({ posts: many(posts), }));

export const postsRelations = relations(posts, ({ one }) => ({ author: one(users, { fields: [posts.authorId], references: [users.id], }), })); ` and I use drizzle-kit push and then try to open drizzle studio it keeps loading with this error

Screenshot 2024-07-11 at 9 13 04 PM

I'm using planet scale and foreign keys are allowed. Also when I remove .references(() => users.id), the studio opens normally.

I'm using drizzle-kit: v0.21.4 drizzle-orm: v0.30.10 "@planetscale/database": "^1.18.0",

mahmoudesmaill commented 2 months ago

image