Lukas
Lukas
XXata
Created by Lukas on 9/9/2024 in #help
A problem with Drizzle and Auth.js
Hey I try to use Auth.js together with Drizzle and as the DB Xata.io. I set everything up and then just copied the Drizzle Schema from the official Auth.js site (https://authjs.dev/getting-started/adapters/drizzle) . When I try to do push it to the DB (npx drizzle-kit push) I get the following error: error: relation "public.user" does not exist { length: 349, severity: 'ERROR', code: '42P01', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: 'SQL statement "ALTER TABLE "post" ADD CONSTRAINT "post_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action"\n' + 'PL/pgSQL function inline_code_block line 2 at SQL statement', schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'namespace.c', line: '449', routine: 'RangeVarGetRelidExtended' } I tried out a lot and found out that the error comes because of this lines of code:
userId: varchar("user_id", { length: 255 }) .notNull() .references(() => users.id, { onDelete: "cascade" }), <--- But I doesnt find a solution for that. Thank u a lot for ur help. Lukas
4 replies