Supabase Database w/ Prisma, not return `slug` column.
Hi,
So I have the following model described with Prisma.
My table in Supabase show all the correct columns, and my seed script populated the
slug table with unique identifiers.
However, when using Prisma, I'm unable to get the slug column back from Supabase.
Is there something unique with a column named slug? Do I need to interact with the slug column?
Things I have tried:
- npx prisma db pull
- npx prima db push3 Replies
You selected the bot's instantaneous insights. Let me compile your answer right away!
Based on the information in the knowledge sources, there is no indication that Prisma or Supabase treats a column named slug in a special or unique way. The slug column should be handled like any other String column with a @unique constraint.
However, there are a few relevant issues and troubleshooting steps to consider:
1. Introspection Issues: There have been cases where Prisma's introspection (
- Double-check your database directly (via Supabase SQL editor) to ensure the slug column exists and is populated. - Make sure your Prisma schema is up to date with
prisma db pull) does not pick up unique constraints or even columns under certain circumstances, especially if the database schema and the Prisma schema get out of sync. For example, a unique constraint on slug was not reflected in the Prisma schema after introspection, even though it existed in the database. This was reported as a bug, but the column itself should still appear unless there is a deeper schema mismatch or migration issue Postgres Introspection occasionally removes "Unique" Constraint.
2. Migration Problems: If you have recently added the slug column and made it required (NOT NULL) and unique, but there are existing rows with NULL values or missing the column, migrations can fail or behave unexpectedly. This can result in the column not being properly available to Prisma queries, or Prisma not being able to map it correctly Error P3006 - Null constraint failed.
3. Database Schema Sync: If you have run both prisma db pull and prisma db push and the column still does not appear in your Prisma results, double-check that:
- The column exists in the Supabase table and is populated for all rows.
- Your Prisma schema matches the actual database schema.
- There are no migration errors or warnings about the slug column.
4. No Special Handling for slug: There is no evidence in the knowledge sources that Prisma or Supabase treats the slug column name in a special way. It should work like any other column.
Recommendation:- Double-check your database directly (via Supabase SQL editor) to ensure the slug column exists and is populated. - Make sure your Prisma schema is up to date with
prisma db pull.
- If the issue persists, try resetting your migrations or re-introspecting the schema.
If after all these steps the slug column is still missing from Prisma query results, there may be a deeper issue not covered in the current knowledge sources. In that case, providing more details or error logs would help further diagnose the problem.
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.Update:
I added a column
test and I'm getting this error.
However my database does show that the column test is present.Just to confirm: Did you regenerate the PrismaClient with
npx prisma generate?