mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Fix v32 schema migration when MySQL global.time_zone is configured with non-UTC timezone (#86867)
* Fix v32 schema migration when MySQL timezone is not UTC * tweak
This commit is contained in:
parent
b1e939d1f1
commit
58de7b8df0
@ -973,7 +973,9 @@ def _migrate_columns_to_timestamp(
|
|||||||
result = session.connection().execute(
|
result = session.connection().execute(
|
||||||
text(
|
text(
|
||||||
"UPDATE events set time_fired_ts="
|
"UPDATE events set time_fired_ts="
|
||||||
"IF(time_fired is NULL,0,UNIX_TIMESTAMP(time_fired)) "
|
"IF(time_fired is NULL,0,"
|
||||||
|
"UNIX_TIMESTAMP(CONVERT_TZ(time_fired,'+00:00',@@global.time_zone))"
|
||||||
|
") "
|
||||||
"where time_fired_ts is NULL "
|
"where time_fired_ts is NULL "
|
||||||
"LIMIT 250000;"
|
"LIMIT 250000;"
|
||||||
)
|
)
|
||||||
@ -984,8 +986,11 @@ def _migrate_columns_to_timestamp(
|
|||||||
result = session.connection().execute(
|
result = session.connection().execute(
|
||||||
text(
|
text(
|
||||||
"UPDATE states set last_updated_ts="
|
"UPDATE states set last_updated_ts="
|
||||||
"IF(last_updated is NULL,0,UNIX_TIMESTAMP(last_updated)), "
|
"IF(last_updated is NULL,0,"
|
||||||
"last_changed_ts=UNIX_TIMESTAMP(last_changed) "
|
"UNIX_TIMESTAMP(CONVERT_TZ(last_updated,'+00:00',@@global.time_zone)) "
|
||||||
|
"), "
|
||||||
|
"last_changed_ts="
|
||||||
|
"UNIX_TIMESTAMP(CONVERT_TZ(last_changed,'+00:00',@@global.time_zone)) "
|
||||||
"where last_updated_ts is NULL "
|
"where last_updated_ts is NULL "
|
||||||
"LIMIT 250000;"
|
"LIMIT 250000;"
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user