mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Remove SchemaValidationStatus.valid (#122394)
This commit is contained in:
parent
e8b88557ee
commit
b14e8d1609
@ -743,7 +743,7 @@ class Recorder(threading.Thread):
|
|||||||
return
|
return
|
||||||
self.schema_version = schema_status.current_version
|
self.schema_version = schema_status.current_version
|
||||||
|
|
||||||
if schema_status.valid:
|
if not schema_status.migration_needed and not schema_status.schema_errors:
|
||||||
self._setup_run()
|
self._setup_run()
|
||||||
else:
|
else:
|
||||||
self.migration_in_progress = True
|
self.migration_in_progress = True
|
||||||
@ -752,7 +752,7 @@ class Recorder(threading.Thread):
|
|||||||
self.hass.add_job(self.async_connection_success)
|
self.hass.add_job(self.async_connection_success)
|
||||||
|
|
||||||
# First do non-live migration steps, if needed
|
# First do non-live migration steps, if needed
|
||||||
if not schema_status.valid:
|
if schema_status.migration_needed:
|
||||||
result, schema_status = self._migrate_schema_offline(schema_status)
|
result, schema_status = self._migrate_schema_offline(schema_status)
|
||||||
if not result:
|
if not result:
|
||||||
self._notify_migration_failed()
|
self._notify_migration_failed()
|
||||||
@ -774,8 +774,8 @@ class Recorder(threading.Thread):
|
|||||||
# we restart before startup finishes
|
# we restart before startup finishes
|
||||||
return
|
return
|
||||||
|
|
||||||
# Do live migration steps, if needed
|
# Do live migration steps and repairs, if needed
|
||||||
if not schema_status.valid:
|
if schema_status.migration_needed or schema_status.schema_errors:
|
||||||
result, schema_status = self._migrate_schema_live_and_setup_run(
|
result, schema_status = self._migrate_schema_live_and_setup_run(
|
||||||
schema_status
|
schema_status
|
||||||
)
|
)
|
||||||
|
@ -193,9 +193,9 @@ class SchemaValidationStatus:
|
|||||||
"""Store schema validation status."""
|
"""Store schema validation status."""
|
||||||
|
|
||||||
current_version: int
|
current_version: int
|
||||||
|
migration_needed: bool
|
||||||
schema_errors: set[str]
|
schema_errors: set[str]
|
||||||
start_version: int
|
start_version: int
|
||||||
valid: bool
|
|
||||||
|
|
||||||
|
|
||||||
def _schema_is_current(current_version: int) -> bool:
|
def _schema_is_current(current_version: int) -> bool:
|
||||||
@ -223,10 +223,8 @@ def validate_db_schema(
|
|||||||
# columns may otherwise not exist etc.
|
# columns may otherwise not exist etc.
|
||||||
schema_errors = _find_schema_errors(hass, instance, session_maker)
|
schema_errors = _find_schema_errors(hass, instance, session_maker)
|
||||||
|
|
||||||
valid = is_current and not schema_errors
|
|
||||||
|
|
||||||
return SchemaValidationStatus(
|
return SchemaValidationStatus(
|
||||||
current_version, schema_errors, current_version, valid
|
current_version, not is_current, schema_errors, current_version
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user