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

Foreign key constraint deleting all cars for a license instead of cars related to that character #24

Closed
zozomanx opened this issue Dec 18, 2024 · 0 comments · Fixed by #25
Labels
bug Something isn't working need repro This bug report needs confirmation

Comments

@zozomanx
Copy link

Summary

Deleting a character will trigger the foreign key cascade for all cars attached to the license instead of just the cars of the character being deleted.

Reproduction

  1. Have multiple characters with the same license
  2. Give cars to multiple characters
  3. Delete a single character
  4. Lose all of your cars on all characters

Expected behavior

Don't delete cars from other characters that are not being deleted. Just delete the cars of the character that is being deleted.

Actual behavior

All cars of all characters with the same license are deleted because of the cascade delete from the foreign key.

Additional context

I believe removing the foreign key will prevent this from happening. When a character is deleted only the cars associated to that character should be deleted, not all cars associated to the license.

FOREIGN KEY (license) REFERENCES players (license) ON DELETE CASCADE ON UPDATE CASCADE

After reviewing the delete character function it doesn't appear that the license is even used to delete characters, just the citizenID.

I wasn't 100% sure if this is used for anything else so that's why I opened this issue instead of a PR.

image

Current Version

1.4.1

Custom Resources

N/A

@zozomanx zozomanx added bug Something isn't working need repro This bug report needs confirmation labels Dec 18, 2024
@qbox-duck qbox-duck bot added this to Issues Dec 18, 2024
@github-project-automation github-project-automation bot moved this to Todo in Issues Dec 18, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Issues Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need repro This bug report needs confirmation
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant