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

Unexpected Cascade Deletion in 1-to-1 Relationships with AWS Amplify #1084

Open
4 tasks done
logi-richi opened this issue Jan 4, 2024 · 2 comments
Open
4 tasks done
Labels
cms An issue identified as a cms bug/feature pending-response An issue is pending response from the issue requestor pending-triage An issue that is pending triage

Comments

@logi-richi
Copy link

logi-richi commented Jan 4, 2024

Before opening, please confirm:

App Id

d3gamlam9hvbcr

Region

ap-southeast-1

Environment name

staging

Figma File Version (if applicable)

No response

Amplify CLI Version

12.10.0

If applicable, what version of Node.js are you using?

v18.0.0

What operating system are you using?

No response

Browser type?

No response

Describe the bug

Brief Description

Issue: I am experiencing an issue where the content of Model B is being deleted upon the deletion of a related Model A in a 1-to-1 relationship using AWS Amplify. This happens despite the absence of an explicit configuration for cascade deletion.
Expected Behavior: The anticipated behavior is that the deletion of an instance of Model A should not impact the data of the related instance in Model B unless a cascade delete or similar functionality is explicitly set up.

Steps to Reproduce

Environment Setup:
AWS Amplify version: 12.10.0

Schema:

type ModelA @model @auth(rules: [{allow: public}]) {
  id: ID!
  email: AWSEmail!
  createdAt: AWSDateTime
  ModelB: ModelB @hasOne
}

type ModelB @model @auth(rules: [{allow: public}]) {
  id: ID!
  email: AWSEmail!
  createdAt: AWSDateTime
}

Steps take:

  1. Create one content in ModelB table
  2. Create one content in ModelA table with relationship to ModelB table content created in previous step
  3. Delete content in ModelA table

Observed Result:
The associated content in ModelB table was also deleted.

Expected behavior

Content in ModelB table should not be deleted.

Reproduction steps

  1. Create one content in ModelB table
  2. Create one content in ModelA table with relationship to ModelB table content created in previous step
  3. Delete content in ModelA table

Project Identifier

No response

Additional information

No response

@logi-richi logi-richi added the pending-triage An issue that is pending triage label Jan 4, 2024
@ykethan
Copy link
Member

ykethan commented Feb 1, 2024

Hey @logi-richi, From the reproduction steps provided and the data model, I was not able to reproduce the issue. After the delete operation, could you check the DynamoDB table for modelB if the record has been deleted?

@ykethan ykethan added pending-response An issue is pending response from the issue requestor cms An issue identified as a cms bug/feature labels Feb 1, 2024
@edbienes
Copy link

edbienes commented Feb 6, 2024

I experienced the same issue with my project. I checked from DynamoDB table, record marks as _deleted = true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cms An issue identified as a cms bug/feature pending-response An issue is pending response from the issue requestor pending-triage An issue that is pending triage
Projects
None yet
Development

No branches or pull requests

3 participants