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

Public Member Functions

None __init__ (self, int schema_version, dict[str, int] migration_changes)
 
bool migrate_data (self, Recorder instance)
 
DataMigrationStatus migrate_data_impl (self, Recorder instance)
 
None migration_done (self, Recorder instance, Session session)
 
bool needs_migrate (self, Recorder instance, Session session)
 
DataMigrationStatus needs_migrate_impl (self, Recorder instance, Session session)
 

Public Attributes

 migration_changes
 
 schema_version
 

Static Public Attributes

int migration_version = 1
 
 None
 
int required_schema_version = 0
 

Private Member Functions

bool _migrate_data (self, Recorder instance)
 

Detailed Description

Base class for migrations.

Definition at line 2276 of file migration.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.recorder.migration.BaseMigration.__init__ (   self,
int  schema_version,
dict[str, int]  migration_changes 
)
Initialize a new BaseRunTimeMigration.

Definition at line 2284 of file migration.py.

Member Function Documentation

◆ _migrate_data()

bool homeassistant.components.recorder.migration.BaseMigration._migrate_data (   self,
Recorder  instance 
)
private
Migrate some data, returns True if migration is completed.

Definition at line 2293 of file migration.py.

◆ migrate_data()

bool homeassistant.components.recorder.migration.BaseMigration.migrate_data (   self,
Recorder  instance 
)
Migrate some data, return True if migration is completed.

Reimplemented in homeassistant.components.recorder.migration.BaseRunTimeMigration, and homeassistant.components.recorder.migration.BaseOffLineMigration.

Definition at line 2290 of file migration.py.

◆ migrate_data_impl()

◆ migration_done()

None homeassistant.components.recorder.migration.BaseMigration.migration_done (   self,
Recorder  instance,
Session  session 
)
Will be called after migrate returns True or if migration is not needed.

Reimplemented in homeassistant.components.recorder.migration.EntityIDMigration, and homeassistant.components.recorder.migration.EventTypeIDMigration.

Definition at line 2309 of file migration.py.

◆ needs_migrate()

bool homeassistant.components.recorder.migration.BaseMigration.needs_migrate (   self,
Recorder  instance,
Session  session 
)
Return if the migration needs to run.

If the migration needs to run, it will return True.

If the migration does not need to run, it will return False and
mark the migration as done in the database if its not already
marked as done.

Definition at line 2318 of file migration.py.

◆ needs_migrate_impl()

DataMigrationStatus homeassistant.components.recorder.migration.BaseMigration.needs_migrate_impl (   self,
Recorder  instance,
Session   session 
)
Return if the migration needs to run and if it is done.

Reimplemented in homeassistant.components.recorder.migration.EventIDPostMigration, and homeassistant.components.recorder.migration.BaseMigrationWithQuery.

Definition at line 2313 of file migration.py.

Member Data Documentation

◆ migration_changes

homeassistant.components.recorder.migration.BaseMigration.migration_changes

Definition at line 2287 of file migration.py.

◆ migration_version

int homeassistant.components.recorder.migration.BaseMigration.migration_version = 1
static

Definition at line 2281 of file migration.py.

◆ None

homeassistant.components.recorder.migration.BaseMigration.None
static

Definition at line 2279 of file migration.py.

◆ required_schema_version

int homeassistant.components.recorder.migration.BaseMigration.required_schema_version = 0
static

Definition at line 2280 of file migration.py.

◆ schema_version

homeassistant.components.recorder.migration.BaseMigration.schema_version

Definition at line 2286 of file migration.py.


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