Kamii
Kamii
DTDrizzle Team
Created by Kamii on 8/10/2023 in #help
Relational queries with planetscale - findMany etc undefined
Hey there! I am trying setup drizzle orm with relational queries with planetscale, but not sure how to debug this. I am following the docs on the setup for this, but after the setup it seems to not find the correct APIs. svelte kit Connection Setup :
import { drizzle } from 'drizzle-orm/mysql2';
import mysql from 'mysql2/promise';
/** schemas and env **/
const connection = await mysql.createConnection({
uri: DATABASE_URL
});

export const db = drizzle(connection, {
schema: {
...items,
...additionals,
...dishes,
...groups,
...recipes,
...requirements,
...locations
},
mode: 'planetscale'
});
import { drizzle } from 'drizzle-orm/mysql2';
import mysql from 'mysql2/promise';
/** schemas and env **/
const connection = await mysql.createConnection({
uri: DATABASE_URL
});

export const db = drizzle(connection, {
schema: {
...items,
...additionals,
...dishes,
...groups,
...recipes,
...requirements,
...locations
},
mode: 'planetscale'
});
Usage: Here I get a error - TypeError: Cannot read properties of undefined (reading 'findMany')
const result = await db.items.query.findMany();
const result = await db.items.query.findMany();
7 replies