diff --git a/app.py b/app.py index ffc0bf7..7cdd6af 100644 --- a/app.py +++ b/app.py @@ -29,7 +29,7 @@ from ui_builder import install_ui_builder from khl_site.khl_data_center import APP as khl_site_app BASE_DIR = Path(__file__).resolve().parent -BUILD_VERSION = "2026.09.15.5" +BUILD_VERSION = "2026.09.15.6" # compatibility: BUILD_VERSION = "2026.08.26.1" # compatibility: BUILD_VERSION = "2026.08.25.1" # compatibility: BUILD_VERSION = "2026.08.24.15" diff --git a/hockey_data/service.py b/hockey_data/service.py index 00be047..3064c8e 100644 --- a/hockey_data/service.py +++ b/hockey_data/service.py @@ -867,6 +867,13 @@ class HockeyDataService: if row is None: row = Stadium(external_id=identity, source=str(source or "stat2tv")[:32], active=True) session.add(row) + # BUILD138: HockeyDatabase intentionally uses autoflush=False. + # Flush a newly created stadium immediately so another game in the + # same sync transaction can find the same external_id instead of + # creating a duplicate pending row and failing the UNIQUE constraint + # on commit. Stadium has no FK dependencies, so a targeted flush is + # safe and avoids flushing unrelated match-sync changes. + session.flush([row]) manual = str(row.source or "").casefold() == "manual" for field, value in values.items():