From 47a1af860036ac9fea61489f3485d576b3e6f561 Mon Sep 17 00:00:00 2001 From: KaiserBh <41852205+kaiserbh@users.noreply.github.com> Date: Tue, 27 Feb 2024 21:49:13 +1100 Subject: [PATCH] fix(database): postgresql release timestamps timezone handling (#1343) fix(database): Correct timezone handling for release timestamps Changed the column type for release timestamps from 'timestamp' to 'timestamptz' in the PostgreSQL database. This update ensures that the release ages are accurately reflected in the web UI by storing the correct timezone information. Previously, the data was stored in UTC but interpreted as local user time, causing a 3-hour offset in the web UI or in my case 11-hour offset. The conversion now correctly interprets and displays the release times based on UTC. Fixes #1138 --- internal/database/postgres_migrate.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/database/postgres_migrate.go b/internal/database/postgres_migrate.go index ec54a3a..00d267d 100644 --- a/internal/database/postgres_migrate.go +++ b/internal/database/postgres_migrate.go @@ -230,7 +230,7 @@ CREATE TABLE "release" filter TEXT, protocol TEXT, implementation TEXT, - timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + timestamp TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP, info_url TEXT, download_url TEXT, group_id TEXT, @@ -862,5 +862,8 @@ ALTER TABLE filter `UPDATE irc_network SET server = 'irc.nebulance.io' WHERE server = 'irc.nebulance.cc'; +`, + `ALTER TABLE "release" + ALTER COLUMN timestamp TYPE timestamptz USING timestamp AT TIME ZONE 'UTC'; `, }