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
Validation error when shadowDatabaseUrl
is identical to url
(or directUrl
)
#16628
Comments
Because this is a potentially serious issue if the user doesn't use separate databases, I'm going to approve the docs PR as an interim measure. We can remove the warning from the docs when this work is done. |
shadowDatabaseUrl
is identical to url
shadowDatabaseUrl
is identical to url
(or directUrl
)
Another case that could have been prevented by this: #20842 |
shadowDatabaseUrl
is identical to url
(or directUrl
)shadowDatabaseUrl
is identical to url
(or directUrl
)
We already check that url ≠ shadow database url (https://github.com/prisma/prisma-engines/blob/d7eca61ec34d27473cb990402ce406299191[…]ed/schema-engine/connectors/sql-schema-connector/src/flavour.rs — and in the submodules to see where that is used). That wasn't implemented for directUrl when directUrl was added. |
@tomhoule Can you provide some more guidance on what approach I can take to try resolve this issue? |
The gist of the change would be that if directUrl is defined, we would need to compare (in the function linked above) the directUrl with the shadowDatabaseUrl, and otherwise keep the existing comparison (between url and shadowDatabaseUrl). |
@tomhoule I am keen on contributing to this issue, but from what I understand you are saying that this validation should be performed at the engine side right therefore this issue belong to the engine repo? As I see the current client implementation also just feeds the entire schema as a string to the engine, so to perform validation at client side would require some parsing which I assume you think is not the best approach? |
Hi @zlimez — I don't work at Prisma anymore so I'm not responsible for the direction. It could be done either way, the TS code has access to some of the engines parser API. |
Oh okok thank you I understand @janpio may I know what would be the desired approach adding to the engine backend check or validate before passing the schema to the engine |
Yes, this should happen in the engine. |
prisma/docs#4188 raised a valid point that it is bad to use the same database for
shadowDatabaseUrl
as you are using forurl
- your database will be overwritten and you will lose data. The PR adds a warning into the docs, but we can actually do one better and just fail validation of the schema in this case.Internal discussion: https://prisma-company.slack.com/archives/CGMCB82N8/p1670232135999259
The text was updated successfully, but these errors were encountered: