drizzle not showing columns
Answered
Alligator mississippiensis posted this in #help-forum
Alligator mississippiensisOP
im not able to query my columns in drizzle using .query method. this is my drizzle config:
import { type Config } from "drizzle-kit";
import { env } from "@/env";
export default {
schema: "./src/server/db/schema",
dialect: "postgresql",
dbCredentials: {
url: env.DATABASE_URL,
},
out: "./src/server/db/migrations",
} satisfies Config;Answered by Alligator mississippiensis
i fixed it nvm
i was using a multi file schema(separate file for each table in db)
just needed to create an index.ts in root of my schema folder and export all schemas
and then pass it to my db object
i was using a multi file schema(separate file for each table in db)
just needed to create an index.ts in root of my schema folder and export all schemas
export * from "./auth";
export * from "./campaigns";
export * from "./newsletters";
export * from "./smtpServers";
export * from "./subscribers";and then pass it to my db object
import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";
import * as schema from "./schema";
const sql = neon(process.env.DATABASE_URL!);
export const db = drizzle(sql, { schema });1 Reply
Alligator mississippiensisOP
i fixed it nvm
i was using a multi file schema(separate file for each table in db)
just needed to create an index.ts in root of my schema folder and export all schemas
and then pass it to my db object
i was using a multi file schema(separate file for each table in db)
just needed to create an index.ts in root of my schema folder and export all schemas
export * from "./auth";
export * from "./campaigns";
export * from "./newsletters";
export * from "./smtpServers";
export * from "./subscribers";and then pass it to my db object
import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";
import * as schema from "./schema";
const sql = neon(process.env.DATABASE_URL!);
export const db = drizzle(sql, { schema });Answer