Wahlproblem gefixt
Some checks failed
Deploy yourpart (blue-green) / deploy (push) Failing after 1m22s

This commit is contained in:
Torsten Schulz (local)
2026-06-06 12:35:27 +02:00
parent bad5b86951
commit 35377e3b59
3 changed files with 22 additions and 15 deletions

View File

@@ -153,8 +153,8 @@ WITH removed AS (
), ),
archived_removed AS ( archived_removed AS (
INSERT INTO falukant_log.political_office_history INSERT INTO falukant_log.political_office_history
(character_id, office_type_id, region_id, start_date, end_date) (character_id, office_type_id, region_id, start_date, end_date, created_at, updated_at)
SELECT character_id, office_type_id, region_id, created_at, NOW() SELECT character_id, office_type_id, region_id, created_at, NOW(), NOW(), NOW()
FROM removed FROM removed
), ),
affected AS ( affected AS (
@@ -183,8 +183,8 @@ to_delete AS (
), ),
archived_trim AS ( archived_trim AS (
INSERT INTO falukant_log.political_office_history INSERT INTO falukant_log.political_office_history
(character_id, office_type_id, region_id, start_date, end_date) (character_id, office_type_id, region_id, start_date, end_date, created_at, updated_at)
SELECT character_id, office_type_id, region_id, created_at, NOW() SELECT character_id, office_type_id, region_id, created_at, NOW(), NOW(), NOW()
FROM to_delete FROM to_delete
) )
DELETE FROM falukant_data.political_office DELETE FROM falukant_data.political_office

View File

@@ -8,13 +8,20 @@ CREATE TABLE IF NOT EXISTS falukant_log.political_office_history (
region_id INTEGER, region_id INTEGER,
start_date TIMESTAMPTZ NOT NULL, start_date TIMESTAMPTZ NOT NULL,
end_date TIMESTAMPTZ NOT NULL, end_date TIMESTAMPTZ NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
); );
-- Tabelle kann bereits vom Backend existieren (ohne region_id o. Ä.): CREATE TABLE IF NOT EXISTS ergänzt keine Spalten. -- Tabelle kann bereits vom Backend existieren (ohne region_id o. Ä.): CREATE TABLE IF NOT EXISTS ergänzt keine Spalten.
ALTER TABLE falukant_log.political_office_history ALTER TABLE falukant_log.political_office_history
ADD COLUMN IF NOT EXISTS region_id INTEGER; ADD COLUMN IF NOT EXISTS region_id INTEGER;
ALTER TABLE falukant_log.political_office_history
ADD COLUMN IF NOT EXISTS created_at TIMESTAMPTZ NOT NULL DEFAULT NOW();
ALTER TABLE falukant_log.political_office_history
ADD COLUMN IF NOT EXISTS updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW();
CREATE INDEX IF NOT EXISTS idx_pol_office_hist_character CREATE INDEX IF NOT EXISTS idx_pol_office_hist_character
ON falukant_log.political_office_history (character_id); ON falukant_log.political_office_history (character_id);

View File

@@ -1134,8 +1134,8 @@ pub const QUERY_SELECT_NEEDED_ELECTIONS: &str = r#"
WHERE (po.created_at + (pot.term_length * INTERVAL '1 day'))::date = td.election_date WHERE (po.created_at + (pot.term_length * INTERVAL '1 day'))::date = td.election_date
), ),
archived_expiring AS ( archived_expiring AS (
INSERT INTO falukant_log.political_office_history (character_id, office_type_id, region_id, start_date, end_date) INSERT INTO falukant_log.political_office_history (character_id, office_type_id, region_id, start_date, end_date, created_at, updated_at)
SELECT character_id, office_type_id, region_id, start_date, end_date SELECT character_id, office_type_id, region_id, start_date, end_date, NOW(), NOW()
FROM offices_ending_today FROM offices_ending_today
), ),
expired_today AS ( expired_today AS (
@@ -1265,8 +1265,8 @@ pub const QUERY_PROCESS_EXPIRED_AND_SCHEDULE: &str = r#"
WHERE (po.created_at + (pot.term_length * INTERVAL '1 day')) <= NOW() WHERE (po.created_at + (pot.term_length * INTERVAL '1 day')) <= NOW()
), ),
archived_expired AS ( archived_expired AS (
INSERT INTO falukant_log.political_office_history (character_id, office_type_id, region_id, start_date, end_date) INSERT INTO falukant_log.political_office_history (character_id, office_type_id, region_id, start_date, end_date, created_at, updated_at)
SELECT character_id, office_type_id, region_id, start_date, term_end SELECT character_id, office_type_id, region_id, start_date, term_end, NOW(), NOW()
FROM doomed FROM doomed
), ),
expired_offices AS ( expired_offices AS (
@@ -1653,8 +1653,8 @@ pub const QUERY_TRIM_EXCESS_OFFICES_GLOBAL: &str = r#"
WHERE rn > seats_total WHERE rn > seats_total
), ),
archived_trim AS ( archived_trim AS (
INSERT INTO falukant_log.political_office_history (character_id, office_type_id, region_id, start_date, end_date) INSERT INTO falukant_log.political_office_history (character_id, office_type_id, region_id, start_date, end_date, created_at, updated_at)
SELECT character_id, office_type_id, region_id, created_at, NOW() SELECT character_id, office_type_id, region_id, created_at, NOW(), NOW(), NOW()
FROM to_delete FROM to_delete
) )
DELETE FROM falukant_data.political_office DELETE FROM falukant_data.political_office
@@ -2532,8 +2532,8 @@ pub const QUERY_DELETE_POLITICAL_OFFICE: &str = r#"
RETURNING character_id, office_type_id, region_id, created_at RETURNING character_id, office_type_id, region_id, created_at
), ),
archived_removed AS ( archived_removed AS (
INSERT INTO falukant_log.political_office_history (character_id, office_type_id, region_id, start_date, end_date) INSERT INTO falukant_log.political_office_history (character_id, office_type_id, region_id, start_date, end_date, created_at, updated_at)
SELECT character_id, office_type_id, region_id, created_at, NOW() SELECT character_id, office_type_id, region_id, created_at, NOW(), NOW(), NOW()
FROM removed FROM removed
), ),
affected AS ( affected AS (
@@ -2575,8 +2575,8 @@ pub const QUERY_DELETE_POLITICAL_OFFICE: &str = r#"
WHERE rn > seats_total WHERE rn > seats_total
), ),
archived_trim AS ( archived_trim AS (
INSERT INTO falukant_log.political_office_history (character_id, office_type_id, region_id, start_date, end_date) INSERT INTO falukant_log.political_office_history (character_id, office_type_id, region_id, start_date, end_date, created_at, updated_at)
SELECT character_id, office_type_id, region_id, created_at, NOW() SELECT character_id, office_type_id, region_id, created_at, NOW(), NOW(), NOW()
FROM to_delete FROM to_delete
) )
DELETE FROM falukant_data.political_office DELETE FROM falukant_data.political_office