diff --git a/homeassistant/components/recorder/migration.py b/homeassistant/components/recorder/migration.py index 1338cab39f6..5f81af68654 100644 --- a/homeassistant/components/recorder/migration.py +++ b/homeassistant/components/recorder/migration.py @@ -1312,7 +1312,7 @@ def migrate_event_type_ids(instance: Recorder) -> bool: for event_type in missing_event_types ] session.add_all(missing_db_event_types) - session.commit() + session.flush() # Assign ids for db_event_type in missing_db_event_types: assert db_event_type.event_type is not None event_type_to_id[