diff --git a/backend/src/database/migrations/084_persoenliche_ausruestung.sql b/backend/src/database/migrations/084_persoenliche_ausruestung.sql index a79118b..3206d90 100644 --- a/backend/src/database/migrations/084_persoenliche_ausruestung.sql +++ b/backend/src/database/migrations/084_persoenliche_ausruestung.sql @@ -30,6 +30,9 @@ CREATE INDEX IF NOT EXISTS idx_persoenliche_ausruestung_artikel ON persoenliche_ausruestung(artikel_id); -- Auto-update aktualisiert_am trigger (uses the aktualisiert_am variant from migration 018) +-- DROP first to make this idempotent — previous failed migration runs may have committed the DDL +-- without recording the migration (pool.query BEGIN/ROLLBACK does not guarantee same connection). +DROP TRIGGER IF EXISTS trg_persoenliche_ausruestung_aktualisiert_am ON persoenliche_ausruestung; CREATE TRIGGER trg_persoenliche_ausruestung_aktualisiert_am BEFORE UPDATE ON persoenliche_ausruestung FOR EACH ROW EXECUTE FUNCTION update_aktualisiert_am_column();