1 """Events schema repairs."""
3 from __future__
import annotations
5 from typing
import TYPE_CHECKING
7 from ...db_schema
import EventData, Events
9 correct_db_schema_precision,
10 correct_db_schema_utf8,
11 validate_db_schema_precision,
12 validate_table_schema_has_correct_collation,
13 validate_table_schema_supports_utf8,
17 from ...
import Recorder
21 """Do some basic checks for common schema errors caused by manual migration."""
23 instance, EventData, (EventData.shared_data,)
25 for table
in (Events, EventData):
32 schema_errors: set[str],
34 """Correct issues detected by validate_db_schema."""
35 for table
in (Events, EventData):
set[str] validate_db_schema(Recorder instance)
None correct_db_schema(Recorder instance, set[str] schema_errors)
None correct_db_schema_precision(Recorder instance, type[DeclarativeBase] table_object, set[str] schema_errors)
set[str] validate_table_schema_has_correct_collation(Recorder instance, type[DeclarativeBase] table_object)
None correct_db_schema_utf8(Recorder instance, type[DeclarativeBase] table_object, set[str] schema_errors)
set[str] validate_db_schema_precision(Recorder instance, type[DeclarativeBase] table_object)
set[str] validate_table_schema_supports_utf8(Recorder instance, type[DeclarativeBase] table_object, tuple[InstrumentedAttribute,...] columns)