azerothcore / azerothcore-wotlk

Complete Open Source and Modular solution for MMO
http://www.azerothcore.org
GNU Affero General Public License v3.0
6.13k stars 2.46k forks source link

Add foreign key to delete the characters if the account is deleted #19210

Open mornil opened 4 days ago

mornil commented 4 days ago

Changes Proposed:

Issues Addressed:

https://github.com/azerothcore/azerothcore-wotlk/issues/19194

SOURCE:

Tests Performed:

How to Test the Changes:

  1. Create an account.
  2. Login and create a character. Logout
  3. Delete the account in the database -> the character is also removed

Known Issues and TODO List:

 Do not remove the instructions below about testing, they will help users to test your PR -->

How to Test AzerothCore PRs

When a PR is ready to be tested, it will be marked as [WAITING TO BE TESTED].

You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here:

http://www.azerothcore.org/wiki/How-to-test-a-PR

REMEMBER: when testing a PR that changes something generic (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but especially check that the PR does not cause any regression (i.e. introducing new bugs).

For example: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but we should test Y and Z as well.

Nyeriah commented 4 days ago

No, this needs to be done by the core because characters aren’t a lone entity. They also have items, spells, achievements… and this would lead to all that junk being left behind.

Kitzunu commented 4 days ago

Correct. It should be handled with the account- and character delete commands

mornil commented 4 days ago

Should not those tables at least have foreign key contraints? The issue is if you want to delete 1000:s of account.

Nyeriah commented 4 days ago

My understanding is that would be a nightmare to manage and it requires further study of what could go wrong during run time, e.g items being moved from character to bank, especially guild bank, so on, so forth.