From 6e6663376db7f26cbc8c43ac3296de113039c908 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 19 Mar 2026 22:14:44 +0100 Subject: [PATCH] fix(migrations): make V5/V6 idempotent with IF NOT EXISTS Avoids Flyway errors when columns already exist in the DB due to migration history mismatches from parallel feature branches. Co-Authored-By: Claude Sonnet 4.6 --- .../main/resources/db/migration/V5__add_notes_to_persons.sql | 2 +- .../db/migration/V6__add_birth_death_years_to_persons.sql | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/resources/db/migration/V5__add_notes_to_persons.sql b/backend/src/main/resources/db/migration/V5__add_notes_to_persons.sql index 8e6514f1..6b82f236 100644 --- a/backend/src/main/resources/db/migration/V5__add_notes_to_persons.sql +++ b/backend/src/main/resources/db/migration/V5__add_notes_to_persons.sql @@ -1 +1 @@ -ALTER TABLE persons ADD COLUMN notes TEXT; +ALTER TABLE persons ADD COLUMN IF NOT EXISTS notes TEXT; diff --git a/backend/src/main/resources/db/migration/V6__add_birth_death_years_to_persons.sql b/backend/src/main/resources/db/migration/V6__add_birth_death_years_to_persons.sql index 31875721..fc3759c0 100644 --- a/backend/src/main/resources/db/migration/V6__add_birth_death_years_to_persons.sql +++ b/backend/src/main/resources/db/migration/V6__add_birth_death_years_to_persons.sql @@ -1,2 +1,2 @@ -ALTER TABLE persons ADD COLUMN birth_year INTEGER; -ALTER TABLE persons ADD COLUMN death_year INTEGER; +ALTER TABLE persons ADD COLUMN IF NOT EXISTS birth_year INTEGER; +ALTER TABLE persons ADD COLUMN IF NOT EXISTS death_year INTEGER;