Convert Prisma sample from v6 to v7 #355
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the Prisma sample from Prisma v6 to Prisma v7. There were major version changes which caused incompatibilities with our previous sample, such that Dependabot was unable to complete the upgrade without manual changes. It tried in #295 and #284.
The major change is the replacement of
DATABASE_URLwith aprisma.config.tsfile. This is quite convenient for DSQL since previously it was awkward for users to generate a token and embed it in theDATABASE_URLvariable, given the password would expire. Now we can generate a token on the fly as part of theprisma.config.tsfile like we do in our connector libraries.You will notice that it's now necessary to provide
CLUSTER_ENDPOINTeven when doing things likenpm run buildwhich doesn't make a lot of sense, but this seems to be a side-effect of the way Prisma requires the configuration file any time a Prisma command is run. We could probably provide a dummy URL or something but that may be confusing in the sample code, and in practice it's easy to define theCLUSTER_ENDPOINTenv var first and just leave it defined. In practice I think users may hard code their endpoint in the config file anyway, in which case this won't be an issue.By submitting this pull request, I confirm that my contribution is made under the terms of the MIT-0 license.