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
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",
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
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",