Fix entity_id migration query failing with MySQL 8.0.30 (#90895)

This commit is contained in:
J. Nick Koston 2023-04-05 22:34:13 -10:00 committed by Paulus Schoutsen
parent 0b3012071e
commit 70d1e733f6

View File

@ -730,7 +730,8 @@ def batch_cleanup_entity_ids() -> StatementLambdaElement:
lambda: update(States) lambda: update(States)
.where( .where(
States.state_id.in_( States.state_id.in_(
select(States.state_id).join( select(States.state_id)
.join(
states_with_entity_ids := select( states_with_entity_ids := select(
States.state_id.label("state_id_with_entity_id") States.state_id.label("state_id_with_entity_id")
) )
@ -739,6 +740,8 @@ def batch_cleanup_entity_ids() -> StatementLambdaElement:
.subquery(), .subquery(),
States.state_id == states_with_entity_ids.c.state_id_with_entity_id, States.state_id == states_with_entity_ids.c.state_id_with_entity_id,
) )
.alias("states_with_entity_ids")
.select()
) )
) )
.values(entity_id=None) .values(entity_id=None)