diff --git a/homeassistant/components/recorder/migration.py b/homeassistant/components/recorder/migration.py index c34d05b3ade..44b4a980238 100644 --- a/homeassistant/components/recorder/migration.py +++ b/homeassistant/components/recorder/migration.py @@ -607,7 +607,7 @@ def _update_states_table_with_foreign_key_options( "columns": foreign_key["constrained_columns"], } for foreign_key in inspector.get_foreign_keys(TABLE_STATES) - if foreign_key["name"] + if foreign_key["name"] # It's not possible to drop an unnamed constraint and ( # MySQL/MariaDB will have empty options not foreign_key.get("options") @@ -663,7 +663,7 @@ def _drop_foreign_key_constraints( if foreign_key["name"] and foreign_key["constrained_columns"] == [column] ] - ## Bind the ForeignKeyConstraints to the table + ## Find matching named constraints and bind the ForeignKeyConstraints to the table tmp_table = Table(table, MetaData()) drops = [ ForeignKeyConstraint((), (), name=foreign_key["name"], table=tmp_table) @@ -829,9 +829,9 @@ def _delete_foreign_key_violations( result = session.connection().execute( # We don't use an alias for the table we're deleting from, # support of the form `DELETE FROM table AS t1` was added in - # MariaDB 11.6 and is not supported by MySQL. Those engines - # instead support the from `DELETE t1 from table AS t1` which - # is not supported by PostgreSQL and undocumented for MariaDB. + # MariaDB 11.6 and is not supported by MySQL. MySQL and older + # MariaDB instead support the from `DELETE t1 from table AS t1` + # which is undocumented for MariaDB. text( f"DELETE FROM {table} " # noqa: S608 "WHERE ("