Implement election candidate table readiness check in character deletion process: Added a new SQL query to verify the existence of the election candidate table before attempting to delete associated records. Updated the deletion logic in both EventsWorker and UserCharacterWorker to conditionally execute the deletion of election candidates based on the table's readiness, improving robustness and preventing errors in environments where the table may not exist.
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 1m39s

This commit is contained in:
Torsten Schulz (local)
2026-04-21 11:48:53 +02:00
parent a38beadb8e
commit 397b612bf1
4 changed files with 304 additions and 4 deletions

View File

@@ -2577,6 +2577,16 @@ pub const QUERY_DELETE_ELECTION_CANDIDATE: &str = r#"
WHERE character_id = $1;
"#;
/// Legacy-/Migrationsschutz: Tabelle existiert nicht in allen Umgebungen.
pub const QUERY_ELECTION_CANDIDATE_TABLE_READY: &str = r#"
SELECT EXISTS (
SELECT 1
FROM information_schema.tables
WHERE table_schema = 'falukant_data'
AND table_name = 'election_candidate'
) AS ready;
"#;
pub const QUERY_GET_STOCK_TYPE_ID: &str = r#"
SELECT id FROM falukant_type.stock WHERE label_tr = $1 LIMIT 1;
"#;