Hi, My project works fine with [email protected] using postgres.
But running:
npx [email protected] lift up
outputs:
Error: Unknown database type postgres:
Please try postgresql, this change was made a while ago though. I am not sure how it only emerged now.
Please share your full schema as well, if possible
I will do when possible @divyenduz :)
I can elaborate a bit on the error.
The database it refers to as type postgres, is actually the beginning of my postgres url in the url property of my datasource.
If I change my url to eg. notvalidurl://username:password@host:5432
It will print ‘ Error: Unknown database type notvalidurl:’
Hope it makes more sense
Thanks, I understand, I think this was fixed to "postgresql" a few releases ago, you faced this between 11 and 12 confused me. We will try it on both and figure what caused this.
Please note that supporting only postgresql is the intended behavior. An error for postgres://.. is expected.
I can confirm that the following works in Preview 11 but does not work in Preview 12
datasource db {
provider = "postgresql"
url = "postgres://root:prisma@localhost:5432/postgres?schema=p2-pg"
}
I can also confirm that we need to support this form of connection string because that is what Heroku provides. Marking this as a bug.
P.S. This should have been handled in the release notes as well 🙏
Perfect :) I updated my code to use postgresql:// and i can confirm that it works :)
For the Lift part:
prisma2 PR: https://github.com/prisma/prisma2/pull/751
prisma-engine PR: https://github.com/prisma/prisma-engine/pull/101
A note for our users:
This issue tracks releasing alpha when a PR into prisma-engine is merged: https://github.com/prisma/prisma2/issues/658
Till that is closed, we manually close issues that rely on Prisma Engine.
tl;dr; this is not released yet but will be soon.
@divyenduz can I close this issue?
This is available in the latest alpha (npm install -g prisma2@alpha) and preview (npm install -g prisma2).
@divyenduz I can't seem to get this to work at all. Event after updating -g and local version of prisma. Anything I am missing?
Can you tell me the output of prisma2 -v?
Also, make sure to prisma2 dev in order to update your photon client and database.
[email protected], binary version: 20b6dc13949cccccfef5be07c0be7a3d7c858abe
Also, make sure to prisma2 dev in order to update your photon client and database.
This throws the error as well:
Error: Unknown database type postgres:
@iRoachie Can you please make a new issue about this with a reproduction 🙏 ?
Sure @pantharshit00 https://github.com/iRoachie/prisma2-postgres-bug. Not sure if making a new issue makes sense since it's the exact same problem (nothing changed).
The example is the starter template anyway. The bug is very present without any configuration right out of the box.
I can confirm this now, looks like we are not accepting postgres:// url schema when using an environment variable.
The easy workaround is to use postgresql:// instead of postgres:// in the url schema.
This isn't really possible for some environments.
For example, hosting on Heroku, Postgres changes the URL frequently. When the URL changes, they automatically restart your app with the new URL. To access the db you have to use the environment variable they provide (which unfortunately is postgres://). In this scenario, I can't change the URL.
That is why I have marked this as a bug and we will fix this :)
I investigated this for a bit, and it looks like the error comes from inside the lift typescript code: https://github.com/prisma/prisma2/blob/17567a92bc8f66bac335e19f9cafa772b0567982/cli/introspection/src/convertCredentials.ts#L102
It's fixed apparently, maybe we should try again with preview 16.
I can also confirm that it happens in the latest alpha.
Internal Note: Dropping this for now, as the Rust implementation is replacing the TypeScript implementation within the next weeks.
@pantharshit00 can I remove the repo now?
Yes, you can remove the repo now as we have identified the cause.
Thanks a lot for reporting 🙏
This issue is fixed in the latest alpha version of prisma2.
You can try it out with npm i -g prisma2@alpha.
In case it’s not fixed for you - please let us know and we’ll reopen this issue!
Most helpful comment
For the Lift part:
prisma2 PR: https://github.com/prisma/prisma2/pull/751
prisma-engine PR: https://github.com/prisma/prisma-engine/pull/101