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:
@@ -43,6 +43,7 @@ use crate::worker::sql::{
|
||||
QUERY_DELETE_RELATIONSHIP,
|
||||
QUERY_GET_USER_ID,
|
||||
QUERY_DELETE_CHILD_RELATION,
|
||||
QUERY_DELETE_CHILD_RELATION_BY_PARENT,
|
||||
QUERY_DELETE_CHARACTER,
|
||||
QUERY_GET_HEIR,
|
||||
QUERY_SET_CHARACTER_USER,
|
||||
@@ -1486,8 +1487,10 @@ impl EventsWorker {
|
||||
Self::handle_inheritance(pool, broker, &mut conn, character_id, falukant_user_id)?;
|
||||
}
|
||||
|
||||
// 4) Child-Relations löschen und Eltern benachrichtigen
|
||||
conn.prepare("delete_child_relation", QUERY_DELETE_CHILD_RELATION)?;
|
||||
// 4) Child-Relations löschen (als Elter zuerst, dann als Kind) und Eltern benachrichtigen
|
||||
conn.prepare("delete_child_relation_by_parent", QUERY_DELETE_CHILD_RELATION_BY_PARENT)?;
|
||||
conn.execute("delete_child_relation_by_parent", &[&character_id])?;
|
||||
conn.prepare("delete_child_relation", QUERY_DELETE_CHILD_RELATION)?;
|
||||
let child_result = conn.execute("delete_child_relation", &[&character_id])?;
|
||||
for row in child_result {
|
||||
if let Some(father_user_id) = row
|
||||
|
||||
Reference in New Issue
Block a user