Skip to content

Drizzle schema not passed to DB instance in new project #705

@joaodematte

Description

@joaodematte

First of all, thank you — I really love this project!

When creating a new project using Drizzle as the ORM, the generated setup does not pass the schema to the Drizzle instance. As a result, TypeScript inference fails and Drizzle reports that the schema generic is missing.

Image

Adding the schema import and passing it to the Drizzle config resolves the issue:

 import { drizzle } from 'drizzle-orm/node-postgres';
+import * as schema from './schema/auth';

-export const db = drizzle(process.env.DATABASE_URL ?? '');
+export const db = drizzle(process.env.DATABASE_URL ?? '', {
+  schema,
+});

After this change, Drizzle correctly infers table types and .query.<tableName> becomes available.

Is this really an issue, or is this the intended behavior for the project?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions