Error using "with" in nextjs

Hey, I'm using mysql and next.js and I'm migrating from Prisma to Drizzle. I don't know why, but when I try getting items using "with", it says: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(select coalesce(json_arrayagg(json_array(category_items.id, category_it...'at line 1. WIthout the "with" it works fine.

My query:
await db.query.category.findMany({ with: { items: true, }, });


and the relations:
export const itemRelations = relations(item, ({ many, one }) => ({ incredients: many(itemingredient), addons: many(itemaddon), category: one(category, { fields: [item.categoryId], references: [category.id], }), sizes: many(size), orders: many(order), coupon: many(coupon), })); export const categoryRelations = relations(category, ({ many }) => ({ items: many(item), }));
Was this page helpful?