Hi all, A recent change to heroku postgresql (<ht...
# prisma-client
j
Hi all, A recent change to heroku postgresql (https://devcenter.heroku.com/changelog-items/2446) is causing us some problems because extensions are now by default install in the
heroku_ext
namespace, and can only be installed in the
heroku_ext
namespace. Our application uses a custom schema
mobile
in our datasource definition
schema=mobile
in data source url as per Postgresql connection documentation in prisma. The problem is that because we are using a custom schema, it looks like the Quaint db driver fully clobbers the
search_path
to just
set search_path = mobile
which makes our migrations fail when looking for installed extensions. A short form of the fully failing migration is: And then this is our output:
Copy code
Prisma schema loaded from db/schema.prisma
Datasource "db": PostgreSQL database "d3o13esjuu8i9a", schema "mobile" at "<http://ec2-3-222-74-92.compute-1.amazonaws.com:5432|ec2-3-222-74-92.compute-1.amazonaws.com:5432>"
18 migrations found in prisma/migrations
Applying migration `20220323211357_create_mobile_schema` // this is CREATE SCHEMA IF NOT EXISTS mobile;
Applying migration `20220323223149_enable_extensions`   // this contains CREATE EXTENSION IF NOT EXISTS "citext" - and succeeds
Applying migration `20220324172504_create_users`
Error: P3018
A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: <https://pris.ly/d/migrate-resolve>
Migration name: 20220324172504_create_users
Database error code: 42704
Database error:
ERROR: type "citext" does not exist // I'm guess this is because the citext extension is now in the `heroku_ext` namespace which is not in the search_path
Position:
  0
  1 -- CreateTable
  2 CREATE TABLE "users" (
  3     "id" UUID NOT NULL DEFAULT gen_random_uuid(),
  4     "email" CITEXT NOT NULL,

DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E42704), message: "type \"citext\" does not exist", detail: None, hint: None, position: Some(Original(101)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("parse_type.c"), line: Some(270), routine: Some("typenameType") }
I'm pretty sure that is because at the time that the create table is happening, the search path is only
mobile
and not
mobile, heroku_ext
Is this the right forum to post this or should I be posting this to the GitHub Issues for prisma, or to the prisma-engines repos?
If anyone is following along - I have filed this bug with prisma - https://github.com/prisma/prisma/issues/14662
👍 2