Skip to content
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

chore: added cascade delete sections in Has One and Has Many data mod… #8189

Merged
merged 3 commits into from
Jan 10, 2025

Conversation

tejas2008
Copy link
Contributor

@tejas2008 tejas2008 commented Jan 8, 2025

Description of changes:

Enhanced Documentation for Data Modeling Relationships

1. "Has One" Relationship Updates
  • Added a new subsection detailing cascade delete functionality
  • Incorporated code snippets using existing examples to illustrate the process
2. "Has Many" Relationship Updates
  • Introduced a dedicated segment explaining cascade delete operations
  • Provided practical code examples based on current documentation to demonstrate implementation

Related GitHub issue #, if available:

Instructions and Testing

  • Tested changes locally using fork of aws-amplify docs repo.
  • Verified the code snippets by creating a Gen-2 amplify project and replicated schemas and cascade delete functionality.
  • Below are the images from locally generated docs:

If this PR should not be merged upon approval for any reason, please submit as a DRAFT

Which product(s) are affected by this PR (if applicable)?

  • amplify-cli
  • amplify-ui
  • amplify-studio
  • amplify-hosting
  • amplify-libraries

Which platform(s) are affected by this PR (if applicable)?

  • JS
  • Swift
  • Android
  • Flutter
  • React Native

Please add the product(s)/platform(s) affected to the PR title

Checks

When this PR is ready to merge, please check the box below

  • Ready to merge

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tejas2008 tejas2008 requested a review from josefaidt as a code owner January 8, 2025 23:18
@@ -439,6 +439,29 @@ do {

</InlineFilter>

### Handling orphaned foreign keys on parent record deletion in "Has Many" relationship
Copy link
Contributor

Choose a reason for hiding this comment

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

this will show an empty section for mobile platforms, can we move the heading inside the filter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure will Update it and notify the mobile teams to add similar sections in swift, dart and android.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good! once mobile teams add snippets we can share this section's heading

@@ -794,6 +817,26 @@ val cart = Amplify.API.query(

</InlineFilter>

### Handling orphaned foreign keys on parent record deletion in "Has One" relationship
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure will Update it and notify the mobile teams to add similar sections in swift, dart and android.

josefaidt
josefaidt previously approved these changes Jan 9, 2025
```ts
// Get the IDs of the related members.
const { data: teamWithMembers } = await client.models.Team.get(
{ id: teamId},
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
{ id: teamId},
{ id: teamId },

@@ -794,6 +817,25 @@ val cart = Amplify.API.query(

</InlineFilter>

<InlineFilter filters={["javascript", "angular", "react-native", "react", "nextjs", "vue"]}>
### Handling orphaned foreign keys on parent record deletion in "Has One" relationship
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
### Handling orphaned foreign keys on parent record deletion in "Has One" relationship
### Handling orphaned foreign keys on parent record deletion in "Has One" relationship

@josefaidt josefaidt enabled auto-merge (squash) January 10, 2025 00:05
@josefaidt josefaidt merged commit 685b786 into main Jan 10, 2025
12 checks passed
@josefaidt josefaidt deleted the cascade-delete-update branch January 10, 2025 00:17
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.

3 participants