diff --git a/homeassistant/components/recorder/migration.py b/homeassistant/components/recorder/migration.py index 138d4530bb9..3ef9b65e259 100644 --- a/homeassistant/components/recorder/migration.py +++ b/homeassistant/components/recorder/migration.py @@ -304,7 +304,7 @@ def migrate_schema_non_live( schema_status: SchemaValidationStatus, ) -> SchemaValidationStatus: """Check if the schema needs to be upgraded.""" - end_version = LIVE_MIGRATION_MIN_SCHEMA_VERSION - 1 + end_version = LIVE_MIGRATION_MIN_SCHEMA_VERSION return _migrate_schema( instance, hass, engine, session_maker, schema_status, end_version ) diff --git a/tests/components/recorder/test_migrate.py b/tests/components/recorder/test_migrate.py index e287b150fa6..d753f908e76 100644 --- a/tests/components/recorder/test_migrate.py +++ b/tests/components/recorder/test_migrate.py @@ -71,6 +71,10 @@ async def test_schema_update_calls( "homeassistant.components.recorder.migration._apply_update", wraps=migration._apply_update, ) as update, + patch( + "homeassistant.components.recorder.migration._migrate_schema", + wraps=migration._migrate_schema, + ) as migrate_schema, ): await async_setup_recorder_instance(hass) await async_wait_recording_done(hass) @@ -85,6 +89,11 @@ async def test_schema_update_calls( for version in range(db_schema.SCHEMA_VERSION) ] ) + migrate_schema.assert_has_calls( + [ + call(instance, hass, engine, session_maker, ANY, db_schema.SCHEMA_VERSION), + ] + ) async def test_migration_in_progress(