Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.recorder.migration.EventIDPostMigration Class Reference
Inheritance diagram for homeassistant.components.recorder.migration.EventIDPostMigration:
[legend]
Collaboration diagram for homeassistant.components.recorder.migration.EventIDPostMigration:
[legend]

Public Member Functions

DataMigrationStatus migrate_data_impl (self, Recorder instance)
 
DataMigrationStatus needs_migrate_impl (self, Recorder instance, Session session)
 
- Public Member Functions inherited from homeassistant.components.recorder.migration.BaseRunTimeMigration
bool migrate_data (self, Recorder instance)
 
None queue_migration (self, Recorder instance, Session session)
 
- Public Member Functions inherited from homeassistant.components.recorder.migration.BaseMigration
None __init__ (self, int schema_version, dict[str, int] migration_changes)
 
None migration_done (self, Recorder instance, Session session)
 
bool needs_migrate (self, Recorder instance, Session session)
 

Static Public Attributes

string migration_id = "event_id_post_migration"
 
int migration_version = 2
 
 task = MigrationTask
 
- Static Public Attributes inherited from homeassistant.components.recorder.migration.BaseRunTimeMigration
 task = MigrationTask
 
- Static Public Attributes inherited from homeassistant.components.recorder.migration.BaseMigration
int migration_version = 1
 
 None
 
int required_schema_version = 0
 

Static Private Member Functions

bool _legacy_event_id_foreign_key_exists (Recorder instance)
 

Additional Inherited Members

- Public Attributes inherited from homeassistant.components.recorder.migration.BaseMigration
 migration_changes
 
 schema_version
 

Detailed Description

Migration to remove old event_id index from states.

Definition at line 2662 of file migration.py.

Member Function Documentation

◆ _legacy_event_id_foreign_key_exists()

bool homeassistant.components.recorder.migration.EventIDPostMigration._legacy_event_id_foreign_key_exists ( Recorder  instance)
staticprivate
Check if the legacy event_id foreign key exists.

Definition at line 2714 of file migration.py.

◆ migrate_data_impl()

DataMigrationStatus homeassistant.components.recorder.migration.EventIDPostMigration.migrate_data_impl (   self,
Recorder  instance 
)
Remove old event_id index from states, returns True if completed.

We used to link states to events using the event_id column but we no
longer store state changed events in the events table.

If all old states have been purged and existing states are in the new
format we can drop the index since it can take up ~10MB per 1M rows.

Reimplemented from homeassistant.components.recorder.migration.BaseMigration.

Definition at line 2669 of file migration.py.

◆ needs_migrate_impl()

DataMigrationStatus homeassistant.components.recorder.migration.EventIDPostMigration.needs_migrate_impl (   self,
Recorder  instance,
Session   session 
)
Return if the migration needs to run.

Reimplemented from homeassistant.components.recorder.migration.BaseMigration.

Definition at line 2730 of file migration.py.

Member Data Documentation

◆ migration_id

string homeassistant.components.recorder.migration.EventIDPostMigration.migration_id = "event_id_post_migration"
static

Definition at line 2665 of file migration.py.

◆ migration_version

int homeassistant.components.recorder.migration.EventIDPostMigration.migration_version = 2
static

Definition at line 2667 of file migration.py.

◆ task

homeassistant.components.recorder.migration.EventIDPostMigration.task = MigrationTask
static

Definition at line 2666 of file migration.py.


The documentation for this class was generated from the following file: