Skip to content

Commit d0383c7

Browse files
fix: convert pre-1970 timestamps when migrating to UTC (ietf-tools#4419)
* fix: convert pre-1970 timestamps when migrating to UTC * fix: simplify migration code and fix typo
1 parent d18b941 commit d0383c7

1 file changed

Lines changed: 120 additions & 84 deletions

File tree

ietf/utils/migrations/0002_convert_timestamps_to_utc.py

Lines changed: 120 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
# Important: To avoid corrupting timestamps in the database, do not use this migration as a dependency for
44
# future migrations. Use 0003_pause_to_change_use_tz instead.
55
#
6+
import datetime
7+
8+
from zoneinfo import ZoneInfo
69

710
from django.conf import settings
811
from django.db import migrations, connection
912

10-
# to generate the expected list:
13+
# to generate the expected columns list:
1114
#
1215
# from django.db import connection
1316
# from pprint import pp
@@ -108,6 +111,37 @@
108111
('utils_versioninfo', 'time'),
109112
)
110113

114+
def convert_pre1970_timestamps(apps, schema_editor):
115+
"""Convert timestamps that CONVERT_TZ cannot handle
116+
117+
This could be made to do the entire conversion but some tables that require converison
118+
do not use 'id' as their PK. Rather than reinvent the ORM, we'll let SQL do what it can
119+
with CONVERT_TZ and clean up after. The tables that have pre-1970 timestamps both have
120+
'id' columns.
121+
"""
122+
min_timestamp = "1969-12-31 16:00:01" # minimum PST8PDT timestamp CONVERT_TZ can convert to UTC
123+
with connection.cursor() as cursor:
124+
# To get these values, use:
125+
# convert_manually = [
126+
# (tbl, col) for (tbl, col) in expected_datetime_columns
127+
# if cursor.execute(
128+
# f'SELECT COUNT(*) FROM {tbl} WHERE {col} IS NOT NULL AND {col} <= %s',
129+
# (min_timestamp,)
130+
# ) and cursor.fetchone()[0] > 0
131+
# ]
132+
convert_manually = [('doc_docevent', 'time'), ('group_groupevent', 'time')]
133+
pst8pdt = ZoneInfo('PST8PDT')
134+
for (tbl, col) in convert_manually:
135+
cursor.execute(f'SELECT id, {col} FROM {tbl} WHERE {col} < %s', (min_timestamp,))
136+
for (id, naive_in_pst8pdt) in cursor.fetchall():
137+
aware_in_pst8pdt = naive_in_pst8pdt.replace(tzinfo=pst8pdt)
138+
aware_in_utc = aware_in_pst8pdt.astimezone(datetime.timezone.utc)
139+
naive_in_utc = aware_in_utc.replace(tzinfo=None)
140+
cursor.execute(
141+
f'UPDATE {tbl} SET {col}=%s WHERE id=%s',
142+
(naive_in_utc, id)
143+
)
144+
111145

112146
def forward(apps, schema_editor):
113147
# Check that the USE_TZ has been False so far, otherwise we might be corrupting timestamps. If this test
@@ -161,10 +195,11 @@ class Migration(migrations.Migration):
161195

162196
# To generate the queries:
163197
#
198+
# min_timestamp = "1969-12-31 16:00:01" # minimum PST8PDT timestamp CONVERT_TZ can convert to UTC
164199
# pst8pdt_columns = [e for e in expected_datetime_columns if e != ('meeting_timeslot', 'time')]
165200
# queries = []
166201
# for table, column in pst8pdt_columns:
167-
# queries.append(f"UPDATE {table} SET {column} = CONVERT_TZ({column}, 'PST8PDT', 'UTC');")
202+
# queries.append(f"UPDATE {table} SET {column} = CONVERT_TZ({column}, 'PST8PDT', 'UTC') WHERE {column} >= '{min_timestamp}'";)
168203
#
169204
# queries.append("""
170205
# UPDATE meeting_timeslot
@@ -178,92 +213,93 @@ class Migration(migrations.Migration):
178213
operations = [
179214
migrations.RunPython(forward),
180215
migrations.RunSQL("""
181-
UPDATE auth_user SET date_joined = CONVERT_TZ(date_joined, 'PST8PDT', 'UTC');
182-
UPDATE auth_user SET last_login = CONVERT_TZ(last_login, 'PST8PDT', 'UTC');
183-
UPDATE community_documentchangedates SET new_version_date = CONVERT_TZ(new_version_date, 'PST8PDT', 'UTC');
184-
UPDATE community_documentchangedates SET normal_change_date = CONVERT_TZ(normal_change_date, 'PST8PDT', 'UTC');
185-
UPDATE community_documentchangedates SET significant_change_date = CONVERT_TZ(significant_change_date, 'PST8PDT', 'UTC');
186-
UPDATE django_admin_log SET action_time = CONVERT_TZ(action_time, 'PST8PDT', 'UTC');
187-
UPDATE django_migrations SET applied = CONVERT_TZ(applied, 'PST8PDT', 'UTC');
188-
UPDATE django_session SET expire_date = CONVERT_TZ(expire_date, 'PST8PDT', 'UTC');
189-
UPDATE doc_ballotpositiondocevent SET comment_time = CONVERT_TZ(comment_time, 'PST8PDT', 'UTC');
190-
UPDATE doc_ballotpositiondocevent SET discuss_time = CONVERT_TZ(discuss_time, 'PST8PDT', 'UTC');
191-
UPDATE doc_deletedevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
192-
UPDATE doc_docevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
193-
UPDATE doc_dochistory SET expires = CONVERT_TZ(expires, 'PST8PDT', 'UTC');
194-
UPDATE doc_dochistory SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
195-
UPDATE doc_docreminder SET due = CONVERT_TZ(due, 'PST8PDT', 'UTC');
196-
UPDATE doc_document SET expires = CONVERT_TZ(expires, 'PST8PDT', 'UTC');
197-
UPDATE doc_document SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
198-
UPDATE doc_documentactionholder SET time_added = CONVERT_TZ(time_added, 'PST8PDT', 'UTC');
199-
UPDATE doc_initialreviewdocevent SET expires = CONVERT_TZ(expires, 'PST8PDT', 'UTC');
200-
UPDATE doc_irsgballotdocevent SET duedate = CONVERT_TZ(duedate, 'PST8PDT', 'UTC');
201-
UPDATE doc_lastcalldocevent SET expires = CONVERT_TZ(expires, 'PST8PDT', 'UTC');
202-
UPDATE group_group SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
203-
UPDATE group_groupevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
204-
UPDATE group_grouphistory SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
205-
UPDATE group_groupmilestone SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
206-
UPDATE group_groupmilestonehistory SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
207-
UPDATE ipr_iprdisclosurebase SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
208-
UPDATE ipr_iprevent SET response_due = CONVERT_TZ(response_due, 'PST8PDT', 'UTC');
209-
UPDATE ipr_iprevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
210-
UPDATE liaisons_liaisonstatementevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
211-
UPDATE mailinglists_subscribed SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
212-
UPDATE mailinglists_whitelisted SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
213-
UPDATE meeting_floorplan SET modified = CONVERT_TZ(modified, 'PST8PDT', 'UTC');
214-
UPDATE meeting_room SET modified = CONVERT_TZ(modified, 'PST8PDT', 'UTC');
215-
UPDATE meeting_schedtimesessassignment SET modified = CONVERT_TZ(modified, 'PST8PDT', 'UTC');
216-
UPDATE meeting_schedulingevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
217-
UPDATE meeting_session SET modified = CONVERT_TZ(modified, 'PST8PDT', 'UTC');
218-
UPDATE meeting_session SET scheduled = CONVERT_TZ(scheduled, 'PST8PDT', 'UTC');
219-
UPDATE meeting_slidesubmission SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
220-
UPDATE meeting_timeslot SET modified = CONVERT_TZ(modified, 'PST8PDT', 'UTC');
221-
UPDATE message_message SET sent = CONVERT_TZ(sent, 'PST8PDT', 'UTC');
222-
UPDATE message_message SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
223-
UPDATE message_sendqueue SET send_at = CONVERT_TZ(send_at, 'PST8PDT', 'UTC');
224-
UPDATE message_sendqueue SET sent_at = CONVERT_TZ(sent_at, 'PST8PDT', 'UTC');
225-
UPDATE message_sendqueue SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
226-
UPDATE nomcom_feedback SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
227-
UPDATE nomcom_feedbacklastseen SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
228-
UPDATE nomcom_nomination SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
229-
UPDATE nomcom_nomineeposition SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
230-
UPDATE nomcom_topicfeedbacklastseen SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
231-
UPDATE oidc_provider_code SET expires_at = CONVERT_TZ(expires_at, 'PST8PDT', 'UTC');
232-
UPDATE oidc_provider_token SET expires_at = CONVERT_TZ(expires_at, 'PST8PDT', 'UTC');
233-
UPDATE oidc_provider_userconsent SET date_given = CONVERT_TZ(date_given, 'PST8PDT', 'UTC');
234-
UPDATE oidc_provider_userconsent SET expires_at = CONVERT_TZ(expires_at, 'PST8PDT', 'UTC');
235-
UPDATE person_email SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
236-
UPDATE person_historicalemail SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC');
237-
UPDATE person_historicalemail SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
238-
UPDATE person_historicalperson SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC');
239-
UPDATE person_historicalperson SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
240-
UPDATE person_person SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
241-
UPDATE person_personalapikey SET created = CONVERT_TZ(created, 'PST8PDT', 'UTC');
242-
UPDATE person_personalapikey SET latest = CONVERT_TZ(latest, 'PST8PDT', 'UTC');
243-
UPDATE person_personevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
244-
UPDATE request_profiler_profilingrecord SET end_ts = CONVERT_TZ(end_ts, 'PST8PDT', 'UTC');
245-
UPDATE request_profiler_profilingrecord SET start_ts = CONVERT_TZ(start_ts, 'PST8PDT', 'UTC');
246-
UPDATE review_historicalreviewassignment SET assigned_on = CONVERT_TZ(assigned_on, 'PST8PDT', 'UTC');
247-
UPDATE review_historicalreviewassignment SET completed_on = CONVERT_TZ(completed_on, 'PST8PDT', 'UTC');
248-
UPDATE review_historicalreviewassignment SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC');
249-
UPDATE review_historicalreviewersettings SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC');
250-
UPDATE review_historicalreviewrequest SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC');
251-
UPDATE review_historicalreviewrequest SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
252-
UPDATE review_historicalunavailableperiod SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC');
253-
UPDATE review_reviewassignment SET assigned_on = CONVERT_TZ(assigned_on, 'PST8PDT', 'UTC');
254-
UPDATE review_reviewassignment SET completed_on = CONVERT_TZ(completed_on, 'PST8PDT', 'UTC');
255-
UPDATE review_reviewrequest SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
256-
UPDATE review_reviewwish SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
257-
UPDATE south_migrationhistory SET applied = CONVERT_TZ(applied, 'PST8PDT', 'UTC');
258-
UPDATE submit_preapproval SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
259-
UPDATE submit_submissioncheck SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
260-
UPDATE submit_submissionevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
261-
UPDATE tastypie_apikey SET created = CONVERT_TZ(created, 'PST8PDT', 'UTC');
262-
UPDATE utils_versioninfo SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC');
216+
UPDATE auth_user SET date_joined = CONVERT_TZ(date_joined, 'PST8PDT', 'UTC') WHERE date_joined >= '1969-12-31 16:00:01';
217+
UPDATE auth_user SET last_login = CONVERT_TZ(last_login, 'PST8PDT', 'UTC') WHERE last_login >= '1969-12-31 16:00:01';
218+
UPDATE community_documentchangedates SET new_version_date = CONVERT_TZ(new_version_date, 'PST8PDT', 'UTC') WHERE new_version_date >= '1969-12-31 16:00:01';
219+
UPDATE community_documentchangedates SET normal_change_date = CONVERT_TZ(normal_change_date, 'PST8PDT', 'UTC') WHERE normal_change_date >= '1969-12-31 16:00:01';
220+
UPDATE community_documentchangedates SET significant_change_date = CONVERT_TZ(significant_change_date, 'PST8PDT', 'UTC') WHERE significant_change_date >= '1969-12-31 16:00:01';
221+
UPDATE django_admin_log SET action_time = CONVERT_TZ(action_time, 'PST8PDT', 'UTC') WHERE action_time >= '1969-12-31 16:00:01';
222+
UPDATE django_migrations SET applied = CONVERT_TZ(applied, 'PST8PDT', 'UTC') WHERE applied >= '1969-12-31 16:00:01';
223+
UPDATE django_session SET expire_date = CONVERT_TZ(expire_date, 'PST8PDT', 'UTC') WHERE expire_date >= '1969-12-31 16:00:01';
224+
UPDATE doc_ballotpositiondocevent SET comment_time = CONVERT_TZ(comment_time, 'PST8PDT', 'UTC') WHERE comment_time >= '1969-12-31 16:00:01';
225+
UPDATE doc_ballotpositiondocevent SET discuss_time = CONVERT_TZ(discuss_time, 'PST8PDT', 'UTC') WHERE discuss_time >= '1969-12-31 16:00:01';
226+
UPDATE doc_deletedevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
227+
UPDATE doc_docevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
228+
UPDATE doc_dochistory SET expires = CONVERT_TZ(expires, 'PST8PDT', 'UTC') WHERE expires >= '1969-12-31 16:00:01';
229+
UPDATE doc_dochistory SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
230+
UPDATE doc_docreminder SET due = CONVERT_TZ(due, 'PST8PDT', 'UTC') WHERE due >= '1969-12-31 16:00:01';
231+
UPDATE doc_document SET expires = CONVERT_TZ(expires, 'PST8PDT', 'UTC') WHERE expires >= '1969-12-31 16:00:01';
232+
UPDATE doc_document SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
233+
UPDATE doc_documentactionholder SET time_added = CONVERT_TZ(time_added, 'PST8PDT', 'UTC') WHERE time_added >= '1969-12-31 16:00:01';
234+
UPDATE doc_initialreviewdocevent SET expires = CONVERT_TZ(expires, 'PST8PDT', 'UTC') WHERE expires >= '1969-12-31 16:00:01';
235+
UPDATE doc_irsgballotdocevent SET duedate = CONVERT_TZ(duedate, 'PST8PDT', 'UTC') WHERE duedate >= '1969-12-31 16:00:01';
236+
UPDATE doc_lastcalldocevent SET expires = CONVERT_TZ(expires, 'PST8PDT', 'UTC') WHERE expires >= '1969-12-31 16:00:01';
237+
UPDATE group_group SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
238+
UPDATE group_groupevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
239+
UPDATE group_grouphistory SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
240+
UPDATE group_groupmilestone SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
241+
UPDATE group_groupmilestonehistory SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
242+
UPDATE ipr_iprdisclosurebase SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
243+
UPDATE ipr_iprevent SET response_due = CONVERT_TZ(response_due, 'PST8PDT', 'UTC') WHERE response_due >= '1969-12-31 16:00:01';
244+
UPDATE ipr_iprevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
245+
UPDATE liaisons_liaisonstatementevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
246+
UPDATE mailinglists_subscribed SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
247+
UPDATE mailinglists_whitelisted SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
248+
UPDATE meeting_floorplan SET modified = CONVERT_TZ(modified, 'PST8PDT', 'UTC') WHERE modified >= '1969-12-31 16:00:01';
249+
UPDATE meeting_room SET modified = CONVERT_TZ(modified, 'PST8PDT', 'UTC') WHERE modified >= '1969-12-31 16:00:01';
250+
UPDATE meeting_schedtimesessassignment SET modified = CONVERT_TZ(modified, 'PST8PDT', 'UTC') WHERE modified >= '1969-12-31 16:00:01';
251+
UPDATE meeting_schedulingevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
252+
UPDATE meeting_session SET modified = CONVERT_TZ(modified, 'PST8PDT', 'UTC') WHERE modified >= '1969-12-31 16:00:01';
253+
UPDATE meeting_session SET scheduled = CONVERT_TZ(scheduled, 'PST8PDT', 'UTC') WHERE scheduled >= '1969-12-31 16:00:01';
254+
UPDATE meeting_slidesubmission SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
255+
UPDATE meeting_timeslot SET modified = CONVERT_TZ(modified, 'PST8PDT', 'UTC') WHERE modified >= '1969-12-31 16:00:01';
256+
UPDATE message_message SET sent = CONVERT_TZ(sent, 'PST8PDT', 'UTC') WHERE sent >= '1969-12-31 16:00:01';
257+
UPDATE message_message SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
258+
UPDATE message_sendqueue SET send_at = CONVERT_TZ(send_at, 'PST8PDT', 'UTC') WHERE send_at >= '1969-12-31 16:00:01';
259+
UPDATE message_sendqueue SET sent_at = CONVERT_TZ(sent_at, 'PST8PDT', 'UTC') WHERE sent_at >= '1969-12-31 16:00:01';
260+
UPDATE message_sendqueue SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
261+
UPDATE nomcom_feedback SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
262+
UPDATE nomcom_feedbacklastseen SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
263+
UPDATE nomcom_nomination SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
264+
UPDATE nomcom_nomineeposition SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
265+
UPDATE nomcom_topicfeedbacklastseen SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
266+
UPDATE oidc_provider_code SET expires_at = CONVERT_TZ(expires_at, 'PST8PDT', 'UTC') WHERE expires_at >= '1969-12-31 16:00:01';
267+
UPDATE oidc_provider_token SET expires_at = CONVERT_TZ(expires_at, 'PST8PDT', 'UTC') WHERE expires_at >= '1969-12-31 16:00:01';
268+
UPDATE oidc_provider_userconsent SET date_given = CONVERT_TZ(date_given, 'PST8PDT', 'UTC') WHERE date_given >= '1969-12-31 16:00:01';
269+
UPDATE oidc_provider_userconsent SET expires_at = CONVERT_TZ(expires_at, 'PST8PDT', 'UTC') WHERE expires_at >= '1969-12-31 16:00:01';
270+
UPDATE person_email SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
271+
UPDATE person_historicalemail SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC') WHERE history_date >= '1969-12-31 16:00:01';
272+
UPDATE person_historicalemail SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
273+
UPDATE person_historicalperson SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC') WHERE history_date >= '1969-12-31 16:00:01';
274+
UPDATE person_historicalperson SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
275+
UPDATE person_person SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
276+
UPDATE person_personalapikey SET created = CONVERT_TZ(created, 'PST8PDT', 'UTC') WHERE created >= '1969-12-31 16:00:01';
277+
UPDATE person_personalapikey SET latest = CONVERT_TZ(latest, 'PST8PDT', 'UTC') WHERE latest >= '1969-12-31 16:00:01';
278+
UPDATE person_personevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
279+
UPDATE request_profiler_profilingrecord SET end_ts = CONVERT_TZ(end_ts, 'PST8PDT', 'UTC') WHERE end_ts >= '1969-12-31 16:00:01';
280+
UPDATE request_profiler_profilingrecord SET start_ts = CONVERT_TZ(start_ts, 'PST8PDT', 'UTC') WHERE start_ts >= '1969-12-31 16:00:01';
281+
UPDATE review_historicalreviewassignment SET assigned_on = CONVERT_TZ(assigned_on, 'PST8PDT', 'UTC') WHERE assigned_on >= '1969-12-31 16:00:01';
282+
UPDATE review_historicalreviewassignment SET completed_on = CONVERT_TZ(completed_on, 'PST8PDT', 'UTC') WHERE completed_on >= '1969-12-31 16:00:01';
283+
UPDATE review_historicalreviewassignment SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC') WHERE history_date >= '1969-12-31 16:00:01';
284+
UPDATE review_historicalreviewersettings SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC') WHERE history_date >= '1969-12-31 16:00:01';
285+
UPDATE review_historicalreviewrequest SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC') WHERE history_date >= '1969-12-31 16:00:01';
286+
UPDATE review_historicalreviewrequest SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
287+
UPDATE review_historicalunavailableperiod SET history_date = CONVERT_TZ(history_date, 'PST8PDT', 'UTC') WHERE history_date >= '1969-12-31 16:00:01';
288+
UPDATE review_reviewassignment SET assigned_on = CONVERT_TZ(assigned_on, 'PST8PDT', 'UTC') WHERE assigned_on >= '1969-12-31 16:00:01';
289+
UPDATE review_reviewassignment SET completed_on = CONVERT_TZ(completed_on, 'PST8PDT', 'UTC') WHERE completed_on >= '1969-12-31 16:00:01';
290+
UPDATE review_reviewrequest SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
291+
UPDATE review_reviewwish SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
292+
UPDATE south_migrationhistory SET applied = CONVERT_TZ(applied, 'PST8PDT', 'UTC') WHERE applied >= '1969-12-31 16:00:01';
293+
UPDATE submit_preapproval SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
294+
UPDATE submit_submissioncheck SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
295+
UPDATE submit_submissionevent SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
296+
UPDATE tastypie_apikey SET created = CONVERT_TZ(created, 'PST8PDT', 'UTC') WHERE created >= '1969-12-31 16:00:01';
297+
UPDATE utils_versioninfo SET time = CONVERT_TZ(time, 'PST8PDT', 'UTC') WHERE time >= '1969-12-31 16:00:01';
263298
264299
UPDATE meeting_timeslot
265300
JOIN meeting_meeting
266301
ON meeting_meeting.id = meeting_id
267302
SET time = CONVERT_TZ(time, time_zone, 'UTC');
268303
"""),
304+
migrations.RunPython(convert_pre1970_timestamps),
269305
]

0 commit comments

Comments
 (0)