Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
user:kluong:migrating_time_received_to_utc [2022/02/12 03:04] kluong |
user:kluong:migrating_time_received_to_utc [2022/02/17 01:28] (current) kluong |
||
---|---|---|---|
Line 3: | Line 3: | ||
===== Background ===== | ===== Background ===== | ||
+ | Reference from chat: | ||
<code> | <code> | ||
Line 15: | Line 16: | ||
In the production database we need to modify the "time_received" column for multiple table. | In the production database we need to modify the "time_received" column for multiple table. | ||
- | Something like this would work: | + | If we had migrations for the service setup, it would be a bit easier to make this modification, but running manal commands shouldn't be too bad. Something like this would work: |
<code> | <code> | ||
Line 39: | Line 40: | ||
apogee_w_m2 | double precision | | | | apogee_w_m2 | double precision | | | | ||
- | postgres-# ALTER TABLE apple ALTER COLUMN time_received TYPE timestamp WITH TIME ZONE; | ||
- | ERROR: syntax error at or near "ls" | ||
- | LINE 1: ls | ||
- | ^ | ||
postgres=# ALTER TABLE apple ALTER COLUMN time_received TYPE timestamp WITH TIME ZONE; | postgres=# ALTER TABLE apple ALTER COLUMN time_received TYPE timestamp WITH TIME ZONE; | ||
ALTER TABLE | ALTER TABLE | ||
Line 86: | Line 83: | ||
- Then, the production gateway should be updated so that it writes using UTC (pull from master) | - Then, the production gateway should be updated so that it writes using UTC (pull from master) | ||
- Then, the production gateway should be started again | - Then, the production gateway should be started again | ||
+ | |||
+ | |||
+ | It might also be good to get into the routine of running a backup of the database prior to doing large commands: this might be a good way to do this: https://www.tecmint.com/backup-and-restore-postgresql-database/ |