Skip to content

Conversation

@keerlu
Copy link
Contributor

@keerlu keerlu commented Nov 24, 2021

Describe this PR

I've made initial changes to the referential integrity and referential actions docs based on conversations with @tanberry, @pimeys and @dpetrick yesterday. At the moment this is mainly getting up-to-date information in there - we still need to make the organisation of the pages as a whole better.

Comments welcome!

Changes

  • explained difference between emulating in client and handling in the database
  • added info on MongoDB support
  • some copyediting/formatting changes

What issue does this fix?

WIP for issue #2538

Any other relevant information

pimeys
pimeys previously requested changes Nov 24, 2021
Copy link
Contributor

@pimeys pimeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so we need to be extremely clear with what these terms mean. First let's talk about the referential integrity: It's a promise the database gives to the user, that we do not break relationships when modifying our data. The database uses a few tools to implement this, one of them is the foreign key constraint that stops you from modifying things that might break relations, and the other is the referential action that is an addition to the constraint that can trigger additional queries in the database transaction before the actual item gets deleted.

How Prisma's Query Core implements the referential integrity is through a set of referential actions. In our case, using NoAction means we break the referential integrity, and the user can modify things that break relations. We should be clear on this and maybe communicate with the client team to see do we pursue with only the actions, or should we also implement the constraint part.

…ons/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
@janpio janpio self-requested a review November 26, 2021 15:45
keerlu and others added 4 commits November 29, 2021 10:39
…ons/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
…ons/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
…ons/425-referential-actions/index.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
@keerlu keerlu changed the title WIP: update referential integrity and referential actions documentation Update referential integrity and referential actions documentation Nov 29, 2021
keerlu and others added 2 commits November 30, 2021 08:49
…ons/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
…ons/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
@netlify
Copy link

netlify bot commented Dec 3, 2021

✔️ Deploy Preview for prisma2-docs ready!

🔨 Explore the source changes: da84bc1

🔍 Inspect the deploy log: https://app.netlify.com/sites/prisma2-docs/deploys/61c04dda747853000732af5a

😎 Browse the preview: https://deploy-preview-2581--prisma2-docs.netlify.app

Reword opening paragraph
keerlu and others added 6 commits December 20, 2021 09:06
…ons/425-referential-actions/index.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
…ons/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
…ons/425-referential-actions/index.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
@keerlu keerlu dismissed pimeys’s stale review December 20, 2021 10:24

Have addressed now as part of other review comments

@keerlu keerlu merged commit 8185561 into main Dec 20, 2021
@keerlu keerlu deleted the keerlu-referential-emulation branch December 20, 2021 10:25
matthewmueller pushed a commit that referenced this pull request Jan 3, 2022
…2581)

* Initial update to referential integrity documentation

* Add admonition for referential emulation

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Julius de Bruijn <bruijn@prisma.io>

* Remove SQL tab

* Update with correct current support level for Mongo

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/425-referential-actions/index.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update following review comments

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Clarify introspection behaviour with referential emulation

* Make copyedit changes to referential integrity

* Make copyedit changes to referential actions page

* Move warning to referential actions page

* Update 420-referential-integrity.mdx

Reword opening paragraph

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/425-referential-actions/index.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/425-referential-actions/index.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Clarify raw queries not triggering actions as current limitation of referential emulation

* Fix typo

* Add caveat on constraints back to referential integrity page

Co-authored-by: Julius de Bruijn <bruijn@prisma.io>
Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
matthewmueller pushed a commit that referenced this pull request Jul 22, 2022
…2581)

* Initial update to referential integrity documentation

* Add admonition for referential emulation

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Julius de Bruijn <bruijn@prisma.io>

* Remove SQL tab

* Update with correct current support level for Mongo

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/425-referential-actions/index.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update following review comments

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Clarify introspection behaviour with referential emulation

* Make copyedit changes to referential integrity

* Make copyedit changes to referential actions page

* Move warning to referential actions page

* Update 420-referential-integrity.mdx

Reword opening paragraph

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/425-referential-actions/index.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/420-referential-integrity.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Update content/200-concepts/100-components/01-prisma-schema/06-relations/425-referential-actions/index.mdx

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>

* Clarify raw queries not triggering actions as current limitation of referential emulation

* Fix typo

* Add caveat on constraints back to referential integrity page

Co-authored-by: Julius de Bruijn <bruijn@prisma.io>
Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants