DT
Drizzle Team•7mo ago
Nick

Trying to get Drizzle, Lucia and Vercel-postress to work together (no changes to schema detected)

Hi! I'm new to drizzle and lucia and am just having a problem setting up both with vercel-postgres: I'm creating an adapter for Lucia in my schema.ts: export const createAdapter = (db: PgDatabase<any, any, any>) => new DrizzlePostgreSQLAdapter(db, sessionTable, userTable); and using it in db/index.ts. But this doesn't allow drizzle to see the session or user schemas (no changes are detected when I drizzle-kit push )
import { drizzle } from "drizzle-orm/vercel-postgres";
import { sql } from "@vercel/postgres";
import * as schema from "./schema";

export const db = drizzle(sql, { schema });
export const adapter = schema.createAdapter(db);
import { drizzle } from "drizzle-orm/vercel-postgres";
import { sql } from "@vercel/postgres";
import * as schema from "./schema";

export const db = drizzle(sql, { schema });
export const adapter = schema.createAdapter(db);
Any ideas? Sorry if it's obvious! Nick
5 Replies
nr7751
nr7751•7mo ago
I have the exact same setup Drizzle, Lucia and Vercel PostgreSQL: generate genereates the right migration files , but when I try to migrate i claims no changes were made the db deosn't get changed. Maybe it's a common isse?
Nick
NickOP•7mo ago
When did you first have the problem? You make any headway with it? Fixed by moving the adapter out of schema.ts and into db/index.ts and importing the schemas.
nr7751
nr7751•7mo ago
@Nick , good thta you solved it ! It's not related to my issue then. Mine is that Drizzles generates migrations byt doesn't apply them.
Nick
NickOP•7mo ago
Yeah sorry I couldn't be more of a help
nr7751
nr7751•7mo ago
@Nick no worries. I solved it. Great education 😄 . Deleting migrations folder and table and using push to bypass migrations apparently solved the issue
Want results from more Discord servers?
Add your server