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 GitHub
parent 571204fa44
commit 19f71b3bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)