From b5ee8ea5f010a1571062d2d33d6258ce650990f9 Mon Sep 17 00:00:00 2001 From: Danny van Kooten Date: Wed, 14 Nov 2018 09:31:34 +0100 Subject: [PATCH] in postgresql, pageviews.timestamp column should be without timezone --- .../migrations/postgres/22_alter_page_stats_table.sql | 2 +- .../migrations/postgres/23_alter_referrer_stats_table.sql | 2 +- .../migrations/postgres/24_alter_site_stats_table.sql | 2 +- .../migrations/postgres/26_alter_pageviews_table.sql | 7 +++++++ 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 pkg/datastore/sqlstore/migrations/postgres/26_alter_pageviews_table.sql diff --git a/pkg/datastore/sqlstore/migrations/postgres/22_alter_page_stats_table.sql b/pkg/datastore/sqlstore/migrations/postgres/22_alter_page_stats_table.sql index fb592218..b7f12262 100644 --- a/pkg/datastore/sqlstore/migrations/postgres/22_alter_page_stats_table.sql +++ b/pkg/datastore/sqlstore/migrations/postgres/22_alter_page_stats_table.sql @@ -9,7 +9,7 @@ CREATE TABLE page_stats( bounce_rate FLOAT NOT NULL, known_durations INTEGER NOT NULL DEFAULT 0, avg_duration FLOAT NOT NULL, - ts TIMESTAMP NOT NULL + ts TIMESTAMP WITHOUT TIME ZONE NOT NULL ); INSERT INTO page_stats SELECT site_id, hostname_id, pathname_id, pageviews, visitors, entries, bounce_rate, known_durations, avg_duration, (date || ' 00:00:00')::timestamp diff --git a/pkg/datastore/sqlstore/migrations/postgres/23_alter_referrer_stats_table.sql b/pkg/datastore/sqlstore/migrations/postgres/23_alter_referrer_stats_table.sql index ab992ebe..0d17e230 100644 --- a/pkg/datastore/sqlstore/migrations/postgres/23_alter_referrer_stats_table.sql +++ b/pkg/datastore/sqlstore/migrations/postgres/23_alter_referrer_stats_table.sql @@ -9,7 +9,7 @@ CREATE TABLE referrer_stats( bounce_rate FLOAT NOT NULL, known_durations INTEGER NOT NULL DEFAULT 0, avg_duration FLOAT NOT NULL, - ts TIMESTAMP NOT NULL + ts TIMESTAMP WITHOUT TIME ZONE NOT NULL ); INSERT INTO referrer_stats SELECT site_id, hostname_id, pathname_id, groupname, pageviews, visitors, bounce_rate, known_durations, avg_duration, (date || ' 00:00:00')::timestamp diff --git a/pkg/datastore/sqlstore/migrations/postgres/24_alter_site_stats_table.sql b/pkg/datastore/sqlstore/migrations/postgres/24_alter_site_stats_table.sql index b98dc6ae..ebd6a972 100644 --- a/pkg/datastore/sqlstore/migrations/postgres/24_alter_site_stats_table.sql +++ b/pkg/datastore/sqlstore/migrations/postgres/24_alter_site_stats_table.sql @@ -7,7 +7,7 @@ CREATE TABLE site_stats( bounce_rate FLOAT NOT NULL, known_durations INTEGER NOT NULL DEFAULT 0, avg_duration FLOAT NOT NULL, - ts TIMESTAMP NOT NULL + ts TIMESTAMP WITHOUT TIME ZONE NOT NULL ); INSERT INTO site_stats SELECT site_id, pageviews, visitors, sessions, bounce_rate, known_durations, avg_duration, (date || ' 00:00:00')::timestamp diff --git a/pkg/datastore/sqlstore/migrations/postgres/26_alter_pageviews_table.sql b/pkg/datastore/sqlstore/migrations/postgres/26_alter_pageviews_table.sql new file mode 100644 index 00000000..ca541525 --- /dev/null +++ b/pkg/datastore/sqlstore/migrations/postgres/26_alter_pageviews_table.sql @@ -0,0 +1,7 @@ +-- +migrate Up + +ALTER TABLE pageviews ALTER COLUMN timestamp TYPE TIMESTAMP WITHOUT TIME ZONE; + +-- +migrate Down + +ALTER TABLE pageviews ALTER COLUMN timestamp TYPE TIMESTAMP WITH TIME ZONE; \ No newline at end of file