From eabb68ad7d5399f386a317126f4d48faf0067124 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Sun, 24 Mar 2019 20:00:29 +0100 Subject: [PATCH] Do not warn when creating an empty database (#22343) --- homeassistant/components/recorder/migration.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/recorder/migration.py b/homeassistant/components/recorder/migration.py index 972862e7a9c..f81dd9e736f 100644 --- a/homeassistant/components/recorder/migration.py +++ b/homeassistant/components/recorder/migration.py @@ -19,6 +19,11 @@ def migrate_schema(instance): SchemaChanges.change_id.desc()).first() current_version = getattr(res, 'schema_version', None) + if current_version is None: + current_version = _inspect_schema_version(instance.engine, session) + _LOGGER.debug("No schema version found. Inspected version: %s", + current_version) + if current_version == SCHEMA_VERSION: # Clean up if old migration left file if os.path.isfile(progress_path): @@ -32,11 +37,6 @@ def migrate_schema(instance): _LOGGER.warning("Database is about to upgrade. Schema version: %s", current_version) - if current_version is None: - current_version = _inspect_schema_version(instance.engine, session) - _LOGGER.debug("No schema version found. Inspected version: %s", - current_version) - try: for version in range(current_version, SCHEMA_VERSION): new_version = version + 1