Add child relation deletion by parent query: Introduced a new SQL query to delete child relations where the character is either a father or mother. Updated relevant workers to execute this query before deleting child relations, ensuring proper cleanup of relationships during character deletion.

This commit is contained in:
Torsten Schulz (local)
2026-02-04 14:46:57 +01:00
parent 2293c1204b
commit d94fa791b3
8 changed files with 34 additions and 6 deletions

View File

@@ -39,6 +39,7 @@ use crate::worker::sql::{
QUERY_DELETE_DIRECTOR,
QUERY_DELETE_RELATIONSHIP,
QUERY_DELETE_CHILD_RELATION,
QUERY_DELETE_CHILD_RELATION_BY_PARENT,
QUERY_DELETE_KNOWLEDGE,
QUERY_DELETE_DEBTORS_PRISM,
QUERY_DELETE_POLITICAL_OFFICE,
@@ -625,6 +626,7 @@ impl UserCharacterWorker {
conn.prepare("delete_director", QUERY_DELETE_DIRECTOR)?;
conn.prepare("delete_relationship", QUERY_DELETE_RELATIONSHIP)?;
conn.prepare("delete_child_relation", QUERY_DELETE_CHILD_RELATION)?;
conn.prepare("delete_child_relation_by_parent", QUERY_DELETE_CHILD_RELATION_BY_PARENT)?;
conn.prepare("delete_knowledge", QUERY_DELETE_KNOWLEDGE)?;
conn.prepare("delete_debtors_prism", QUERY_DELETE_DEBTORS_PRISM)?;
conn.prepare("delete_political_office", QUERY_DELETE_POLITICAL_OFFICE)?;
@@ -632,6 +634,7 @@ impl UserCharacterWorker {
conn.execute("delete_director", &[&character_id])?;
conn.execute("delete_relationship", &[&character_id])?;
conn.execute("delete_child_relation_by_parent", &[&character_id])?;
conn.execute("delete_child_relation", &[&character_id])?;
conn.execute("delete_knowledge", &[&character_id])?;
conn.execute("delete_debtors_prism", &[&character_id])?;