New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Database error: Error querying the database: db error: ERROR: type "citext" does not exist" but citext extension enabled #5772
Comments
You have to enable the extension from a migration for the shadow database to pick it up. So have a CREATE EXTENSION in your first migration, usually. Keeping the issue open to see if there is any alternative we can think of, but so far I don't consider this a bug. |
We could possibly handle that error message and tell the user this might be a probable source for their problem, and explain how to overcome it. |
In order to handle this error gracefully and produce a specific warning, we'd had to special case errors for unknown column types. While this is technically feasible, it is a lot of work so unlikely we do this short or mid- term. In the meantime, we should make sure the suggested solution (add CREATE EXTENSION to the migration SQL file) is properly documented. |
Relevant docs issue: prisma/docs#1359 |
Hi all, We seem to be facing this issue in our team. We are trying to run the prisma commands in our CI tool and we keep getting this error. Our initial migration creates the extensions as suggested above.
Weirdly, it works absolutely fine locally right now which makes it even harder to debug. The sequence of commands we are running is:
To clarify, the first migration applies fine and then the second command errors. It might be worth noting that we are running against a custom postgres schema so maybe something going on in the shadow db there? Any help with this would be appreciated 🙏 |
Hi @kiily — |
Thanks for the quick reply @tomhoule, let me know if the above is enough. Happy to clarify anything else that might help 👍 |
It's great, thanks! We'll work on it as soon as possible. |
Closing this there a new issue here #6944 |
Bug description
Migrations after the first one fail due to type
citext
not existing, but I've confirmed numerous times and ensured that the citext extension is enabled on my database before I run theprisma migrate
command. After running theprisma migrate
command and seeing the error, I can confirm that the extension is removed from my database.I'm assuming something funky is happening with prisma/shadow DB stuff?
How to reproduce
psql
and runCREATE EXTENSION citext;
on the DB.prisma.schema
with a model that has a citext attribute likeemail String @unique @db.Citext
.prisma migrate dev --preview-feature
prisma.schema
- maybe by adding an attribute likename String
to a model.prisma migrate dev --preview-feature
psql
and you'll notice that the citext extension was removed from your DB.Expected behavior
I expect the migration to succeed.
Prisma information
DEBUG="*" npx prisma migrate dev --preview-feature
is the command I ran.That schema should suffice.
Environment & setup
The text was updated successfully, but these errors were encountered: