From 9c4677a3c650997660be99a898546794dd040c9c Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Wed, 14 Aug 2024 21:22:06 +0200 Subject: [PATCH] Add comment clarifying recorder migration to schema version 16 (#123902) --- homeassistant/components/recorder/migration.py | 4 ++++ 1 file changed, 4 insertions(+) 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" )