How to add schemas to the DB object when using URL for DB connection

I'm using a URL to connect to my database and I cannot figure out the syntax for adding schemas to the DB instance This is how my config looks
import { drizzle, } from "drizzle-orm/mysql2";
import * as schmea from "../drizzle/schema.ts";
const databaseUrl = Bun.env.DATABASE_URL as string;

export const db = drizzle(databaseUrl);
import { drizzle, } from "drizzle-orm/mysql2";
import * as schmea from "../drizzle/schema.ts";
const databaseUrl = Bun.env.DATABASE_URL as string;

export const db = drizzle(databaseUrl);
I get a
Property 'tableExample' does not exist on type 'DrizzleTypeError<"Seems like the schema generic is missing - did you forget to add it to your DB type?">'
Property 'tableExample' does not exist on type 'DrizzleTypeError<"Seems like the schema generic is missing - did you forget to add it to your DB type?">'
error when trying to use db.query.tableExample.findFirst
No description
1 Reply
Mario564
Mario5642w ago
You can find documentation on how to define RQB schema here: https://orm.drizzle.team/docs/rqb
Drizzle ORM - Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Want results from more Discord servers?
Add your server