diff --git a/homeassistant/components/recorder/migration.py b/homeassistant/components/recorder/migration.py index ccdaf3082e0..cbe0dcd7258 100644 --- a/homeassistant/components/recorder/migration.py +++ b/homeassistant/components/recorder/migration.py @@ -1116,6 +1116,10 @@ class _SchemaVersion16Migrator(_SchemaVersionMigrator, target_version=16): SupportedDialect.MYSQL, SupportedDialect.POSTGRESQL, ): + # Version 16 changes settings for the foreign key constraint on + # states.old_state_id. Dropping the constraint is not really correct + # we should have recreated it instead. Recreating the constraint now + # happens in the migration to schema version 45. _drop_foreign_key_constraints( self.session_maker, self.engine, TABLE_STATES, "old_state_id" )