Issues cross-referencing tables from different schemas using Prisma
See original GitHub issueFeature request
Is your feature request related to a problem? Please describe.
I am trying to use Supabase together with Prisma. There seems to be a problem cross-referencing tables in different schemas. I have auth.users
and public.profiles
.
Describe the solution you’d like
I would like to be able to use Prisma to manage Supabase DB, but currently I cannot use Auth schema if it’s referencing any of the tables in the public schema.
Is there are way around this issue?
Additional context
Error message from Prisma CLI:
npx prisma db pull
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Introspecting based on datasource defined in prisma/schema.prisma …
Error: P4002
The schema of the introspected database was inconsistent: Illegal cross schema reference from `public.profiles` to `auth.users` in constraint `profiles_id_fkey`. Foreign keys between database schemas are not supported in Prisma. Please follow the GitHub ticket: https://github.com/prisma/prisma/issues/1175
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (3 by maintainers)
Top Results From Across the Web
How to use Prisma with multiple database schemas
If you have tables with the same name in different database schemas, you will need to map the table names to unique model...
Read more >[solved] Supabase prisma collision - RedwoodJS Community
When I add migrations to my Supabase project that added a trigger to add public.profile records when auth.user records are created I get ......
Read more >Introspecting based on datasource defined in prisma/schema ...
The schema of the introspected database was inconsistent: Illegal cross schema reference from public.profiles to auth.users in constraint ...
Read more >Prisma 4.8.0 Release - GitClear
Additionally, we have started optimizing how the Prisma schema is loaded in Prisma Client. You should notice a considerable improvement when ...
Read more >Prisma Client Python
The Prisma schema · Data source: Specifies your database connection. In this case we use a local SQLite database however you can also...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m looking to set up the exact same thing, I want to manage my tables using Prisma, but have the auth automatically handled by Supabase, it would be amazing.
According to this thread:
But I can’t seem to figure out how, and I can’t find any tutorials or code examples. I’m new to Supabase, and I’d really love it if someone could help me to find a way to set this up correctly.
Did any of you guys find a solution?
For anyone coming here in the future, the page linked by @kiwicopple above no longer contains the needed information but I found it in the git history here https://github.com/supabase/supabase/blob/1315bac01bec4fc70ebc0184b524cd9d890e749d/web/docs/guides/auth.mdx#create-a-publicusers-table