Help Article: Implicit to Explicit Conversion
Help article for converting implicit many-to-many relations to explicit many-to-many
What issue does this fix?
- https://github.com/prisma/docs/issues/3325
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Oct 13, 2023 1:38pm |
This PR changes the following pages (Vercel Preview Deploy links):
Changed Vercel links
(Note that links will only be valid after Vercel preview deploy succeeded)
Redirect check
This PR probably requires the following redirects to be added to static/_redirects:
- This PR does not change any pages in a way that would require a redirect.
I have made the change in code blocks. If it looks good, we can go ahead and merge it.
Ugh, how the deployment fails on Vercel is scary:
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR! https://www.npmjs.com/forgot
npm ERR!
npm ERR! If you were doing some other operation then your saved credentials are
npm ERR! probably out of date. To correct this please try logging in again with:
npm ERR! npm login
npm ERR! A complete log of this run can be found in:
npm ERR! /vercel/.npm/_logs/2023-08-31T17_54_41_543Z-debug-0.log
Error: Command "npm install" exited with 1
Question: Right now, the guide teaches how to create a new model to represent the relation table. Wouldn't it be possible to just reuse the already existing relation table that Prisma maintains for you?
Thanks for this WIP PR, it just helped me out while migrating from an explicit to an implicit relation.
A few quick notes:
- The docs for explicit relations use terms like
CategoriesOnPostswhere this guide usesUserPost(no "on", sigular) Ref: https://github.com/prisma/docs/pull/4768/files#diff-06e28c97d4e53bd73db1d585102122f2cf86088ce4e9e257d9a81bc2e8c26b6aR52 - I had to change the relation part of the schema, nothing to delete as as second step IMO
- surveyResponseTopics SurveyResponseTopicsOnSurveyResponses[] + surveyResponseTopics SurveyResponseTopic[] … - surveyResponses SurveyResponseTopicsOnSurveyResponses[] + surveyResponses SurveyResponse[] - I had to manually modify the migration in order to move the content of the old table:
- Move the
DropTableto the end of the file - Add a migration step right above. The order is special here according to the docs https://www.prisma.io/docs/orm/prisma-schema/data-model/relations/many-to-many-relations#columns "where A points to the model that comes first in the alphabet and B points to the model which comes last in the alphabet".
-- Migrate data INSERT INTO "_SurveyResponseToSurveyResponseTopic"("A", "B") SELECT "surveyResponseId", "surveyResponseTopicId" FROM "SurveyResponseTopicsOnSurveyResponses"; - Move the
Could this be merged now? Stumbled upon this while looking for instructions on moving from implicit to explicit relations (specifically I want to have cascading deletes which aren't supported otherwise)
Deploying docs with Â
 Cloudflare Pages
| Latest commit: |
23f671c
|
| Status: |  ✅ Deploy successful! |
| Preview URL: | https://49341361.docs-51g.pages.dev |
| Branch Preview URL: | https://nurul3101-patch-2.docs-51g.pages.dev |
Dangerous URL check
No absolute URLs to prisma.io/docs found. No local URLs found.
Where is this page in the website? I can't see it.
@MansurAliKoroglu there was a mistake here. This PR should make it visible: https://github.com/prisma/docs/pull/6479