© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
2 replies
jamielarkspur1995

Foreign key from Prisma table to auth.users

Hello!

When I run this sql query, I get an error:
ALTER TABLE "User" ADD FOREIGN KEY ("id") REFERENCES "auth"."users"("id");
ALTER TABLE "User" ADD FOREIGN KEY ("id") REFERENCES "auth"."users"("id");


results in:
Failed to run sql query: foreign key constraint "User_id_fkey" cannot be implemented
Failed to run sql query: foreign key constraint "User_id_fkey" cannot be implemented


I think the error may be on prisma, is this something that cannot be done?

The goal here is that I want to delete a db entry when an auth user is deleted -> perhaps a trigger is more appropriate?

Thanks!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

POST request using foreign key-table
SupabaseSSupabase / help-and-questions
4y ago
Joining auth.user on foreign key id?
SupabaseSSupabase / help-and-questions
4y ago
How to use composite key as foreign key in another table?
SupabaseSSupabase / help-and-questions
4y ago
Deleted the auth.users table
SupabaseSSupabase / help-and-questions
4y ago