Implement comprehensive character deletion process in UserCharacterWorker
- Add queries and logic to delete associated data when a character dies, including directors, relationships, child relations, knowledge, debtors prism, political offices, and election candidates. - Enhance error handling to log issues during the deletion process.
This commit is contained in:
committed by
Torsten (PC)
parent
7591787583
commit
6a1260687b
@@ -369,6 +369,46 @@ private:
|
||||
OR mother_character_id = $1
|
||||
)";
|
||||
|
||||
// Queries zum Löschen von Character-Verknüpfungen beim Tod
|
||||
static constexpr const char *QUERY_DELETE_DIRECTOR = R"(
|
||||
DELETE FROM falukant_data.director
|
||||
WHERE director_character_id = $1
|
||||
RETURNING employer_user_id;
|
||||
)";
|
||||
|
||||
static constexpr const char *QUERY_DELETE_RELATIONSHIP = R"(
|
||||
DELETE FROM falukant_data.relationship
|
||||
WHERE character1_id = $1
|
||||
OR character2_id = $1;
|
||||
)";
|
||||
|
||||
static constexpr const char *QUERY_DELETE_CHILD_RELATION = R"(
|
||||
DELETE FROM falukant_data.child_relation
|
||||
WHERE child_character_id = $1
|
||||
OR father_character_id = $1
|
||||
OR mother_character_id = $1;
|
||||
)";
|
||||
|
||||
static constexpr const char *QUERY_DELETE_KNOWLEDGE = R"(
|
||||
DELETE FROM falukant_data.knowledge
|
||||
WHERE character_id = $1;
|
||||
)";
|
||||
|
||||
static constexpr const char *QUERY_DELETE_DEBTORS_PRISM = R"(
|
||||
DELETE FROM falukant_data.debtors_prism
|
||||
WHERE character_id = $1;
|
||||
)";
|
||||
|
||||
static constexpr const char *QUERY_DELETE_POLITICAL_OFFICE = R"(
|
||||
DELETE FROM falukant_data.political_office
|
||||
WHERE character_id = $1;
|
||||
)";
|
||||
|
||||
static constexpr const char *QUERY_DELETE_ELECTION_CANDIDATE = R"(
|
||||
DELETE FROM falukant_data.election_candidate
|
||||
WHERE character_id = $1;
|
||||
)";
|
||||
|
||||
};
|
||||
|
||||
#endif // USERCHARACTERWORKER_H
|
||||
|
||||
Reference in New Issue
Block a user