Skip to content

Commit 75ff8b3

Browse files
authored
fix: harmonydb: Use timestampz instead of timestamp across the schema (#12030)
* fix: harmonydb: Use timestampz instead of timestamp across the schema * ci: Try YB 2.21 * try smaller alters
1 parent 8cfa00b commit 75ff8b3

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
-- Convert timestamps in harmony_machines table
2+
ALTER TABLE harmony_machines
3+
ALTER COLUMN last_contact TYPE TIMESTAMPTZ
4+
USING last_contact AT TIME ZONE 'UTC';
5+
6+
-- Convert timestamps in harmony_task table
7+
ALTER TABLE harmony_task
8+
ALTER COLUMN update_time TYPE TIMESTAMPTZ
9+
USING update_time AT TIME ZONE 'UTC';
10+
11+
ALTER TABLE harmony_task
12+
ALTER COLUMN posted_time TYPE TIMESTAMPTZ
13+
USING posted_time AT TIME ZONE 'UTC';
14+
15+
-- Convert timestamps in harmony_task_history table
16+
ALTER TABLE harmony_task_history
17+
ALTER COLUMN posted TYPE TIMESTAMPTZ
18+
USING posted AT TIME ZONE 'UTC';
19+
20+
ALTER TABLE harmony_task_history
21+
ALTER COLUMN work_start TYPE TIMESTAMPTZ
22+
USING work_start AT TIME ZONE 'UTC';
23+
24+
ALTER TABLE harmony_task_history
25+
ALTER COLUMN work_end TYPE TIMESTAMPTZ
26+
USING work_end AT TIME ZONE 'UTC';
27+
28+
-- Convert timestamps in sector_location table
29+
ALTER TABLE sector_location
30+
ALTER COLUMN read_ts TYPE TIMESTAMPTZ
31+
USING read_ts AT TIME ZONE 'UTC';
32+
33+
ALTER TABLE sector_location
34+
ALTER COLUMN write_ts TYPE TIMESTAMPTZ
35+
USING write_ts AT TIME ZONE 'UTC';
36+
37+
-- Convert timestamps in storage_path table
38+
ALTER TABLE storage_path
39+
ALTER COLUMN last_heartbeat TYPE TIMESTAMPTZ
40+
USING last_heartbeat AT TIME ZONE 'UTC';
41+
42+
-- Convert timestamps in mining_tasks table
43+
ALTER TABLE mining_tasks
44+
ALTER COLUMN base_compute_time TYPE TIMESTAMPTZ
45+
USING base_compute_time AT TIME ZONE 'UTC';
46+
47+
ALTER TABLE mining_tasks
48+
ALTER COLUMN mined_at TYPE TIMESTAMPTZ
49+
USING mined_at AT TIME ZONE 'UTC';
50+
51+
ALTER TABLE mining_tasks
52+
ALTER COLUMN submitted_at TYPE TIMESTAMPTZ
53+
USING submitted_at AT TIME ZONE 'UTC';
54+
55+
-- Convert timestamps in itest_scratch table
56+
ALTER TABLE itest_scratch
57+
ALTER COLUMN update_time TYPE TIMESTAMPTZ
58+
USING update_time AT TIME ZONE 'UTC';
59+
60+
-- Convert timestamps in message_sends table
61+
ALTER TABLE message_sends
62+
ALTER COLUMN send_time TYPE TIMESTAMPTZ
63+
USING send_time AT TIME ZONE 'UTC';
64+
65+
-- Convert timestamps in message_send_locks table
66+
ALTER TABLE message_send_locks
67+
ALTER COLUMN claimed_at TYPE TIMESTAMPTZ
68+
USING claimed_at AT TIME ZONE 'UTC';
69+
70+
-- Convert timestamps in harmony_task_singletons table
71+
ALTER TABLE harmony_task_singletons
72+
ALTER COLUMN last_run_time TYPE TIMESTAMPTZ
73+
USING last_run_time AT TIME ZONE 'UTC';
74+
75+
-- Convert timestamps in sector_path_url_liveness table
76+
ALTER TABLE sector_path_url_liveness
77+
ALTER COLUMN last_checked TYPE TIMESTAMPTZ
78+
USING last_checked AT TIME ZONE 'UTC';
79+
80+
ALTER TABLE sector_path_url_liveness
81+
ALTER COLUMN last_live TYPE TIMESTAMPTZ
82+
USING last_live AT TIME ZONE 'UTC';
83+
84+
ALTER TABLE sector_path_url_liveness
85+
ALTER COLUMN last_dead TYPE TIMESTAMPTZ
86+
USING last_dead AT TIME ZONE 'UTC';
87+
88+
-- Convert timestamps in harmony_machine_details table
89+
ALTER TABLE harmony_machine_details
90+
ALTER COLUMN startup_time TYPE TIMESTAMPTZ
91+
USING startup_time AT TIME ZONE 'UTC';
92+
93+
-- Convert timestamps in open_sector_pieces table
94+
ALTER TABLE open_sector_pieces
95+
ALTER COLUMN created_at TYPE TIMESTAMPTZ
96+
USING created_at AT TIME ZONE 'UTC';
97+
98+
-- Convert timestamps in parked_pieces table
99+
ALTER TABLE parked_pieces
100+
ALTER COLUMN created_at TYPE TIMESTAMPTZ
101+
USING created_at AT TIME ZONE 'UTC';
102+
103+
-- Convert timestamps in sectors_sdr_pipeline table
104+
ALTER TABLE sectors_sdr_pipeline
105+
ALTER COLUMN create_time TYPE TIMESTAMPTZ
106+
USING create_time AT TIME ZONE 'UTC';
107+
108+
ALTER TABLE sectors_sdr_pipeline
109+
ALTER COLUMN failed_at TYPE TIMESTAMPTZ
110+
USING failed_at AT TIME ZONE 'UTC';
111+
112+
-- Convert timestamps in sectors_sdr_initial_pieces table
113+
ALTER TABLE sectors_sdr_initial_pieces
114+
ALTER COLUMN created_at TYPE TIMESTAMPTZ
115+
USING created_at AT TIME ZONE 'UTC';

0 commit comments

Comments
 (0)