fix(db): Fix time zone consistency issues in monthly billing views
The hcp monthly billing views build a range of buckets using the
`generate_series` and the `now()` functions along with relative offsets
like `+ 1 month`. The calculated start and end times for these views can
vary depending on the time zone setting of the PostgreSQL server.
This adds 3 table functions that call their respective views with the
time zone set to UTC. Calling these functions instead of their
underlying views directly prevents the returned values from varying when
the server's time zone is not set to UTC.
This also drops support for PostgreSQL 11. The included tests use the
`date_trunc(field, source [, time_zone ])` function added in PostgreSQL
12.
Fixes: 41b1b5b4b7
This commit is contained in:
10 files changed
+173
-14
No files matched your search
@@ -1,7 +0,0 @@
|
||||
FROM postgres:11-alpine
|
||||
|
||||
ADD init-db.sh /docker-entrypoint-initdb.d/00-init-db.sh
|
||||
ADD restore-benchmark-dumps.sh /docker-entrypoint-initdb.d/01-restore-benchmark-dumps.sh
|
||||
ADD postgresql.conf /etc/postgresql/postgresql.conf
|
||||
|
||||
CMD ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]
|
||||
@@ -6,7 +6,7 @@ DOCKER_ARGS ?= -d
|
||||
DOCKER_MIRROR?=docker.io
|
||||
REGISTRY_NAME?=hashicorpboundary
|
||||
TEST_IMAGE_NAME=postgres
|
||||
TEST_IMAGE_TAG ?= $(DOCKER_MIRROR)/$(REGISTRY_NAME)/$(TEST_IMAGE_NAME):11-alpine
|
||||
TEST_IMAGE_TAG ?= $(DOCKER_MIRROR)/$(REGISTRY_NAME)/$(TEST_IMAGE_NAME):12-alpine
|
||||
PG_OPTS ?=
|
||||
TEST_DB_PORT ?= 5432
|
||||
TEST_CONTAINER_NAME ?= boundary-sql-tests
|
||||
|
||||
Reference in new issue
Block a user