From 4252bf9d6a6a5f88a22827d5db8b330d7e9d1c50 Mon Sep 17 00:00:00 2001 From: Ziinc Date: Wed, 8 Jan 2025 00:26:03 +0800 Subject: [PATCH] fix: postgres 15 decimal in uptime query (#2294) * fix: postgres 15 decimal in uptime query * chore: version bump to v1.10.8 * chore: bitnami image tag --- .github/workflows/elixir-ci.yml | 2 +- VERSION | 2 +- docker-compose.yml | 2 +- lib/logflare/repo.ex | 10 +++++++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/elixir-ci.yml b/.github/workflows/elixir-ci.yml index 147774649..3d15ed511 100644 --- a/.github/workflows/elixir-ci.yml +++ b/.github/workflows/elixir-ci.yml @@ -43,7 +43,7 @@ jobs: # run: mix test.typings services: postgres: - image: bitnami/postgresql:13.15.0 + image: bitnami/postgresql:15 ports: - 5432:5432 env: diff --git a/VERSION b/VERSION index c67978766..819d3b1fc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.10.7 \ No newline at end of file +1.10.8 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 868551379..2cd63a98e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: "3.9" services: db: - image: postgres:13.4-alpine + image: postgres:15 environment: POSTGRES_PASSWORD: postgres POSTGRES_USER: postgres diff --git a/lib/logflare/repo.ex b/lib/logflare/repo.ex index eb1aafe6c..c137af45d 100644 --- a/lib/logflare/repo.ex +++ b/lib/logflare/repo.ex @@ -16,9 +16,13 @@ defmodule Logflare.Repo do rows: [ [uptime] ] - }} - when is_number(uptime) -> - ceil(uptime) + }} -> + if is_number(uptime) do + ceil(uptime) + else + # for postgres 15 and up + Decimal.round(uptime, 0, :ceiling) + end {:error, _err} = err -> Logger.warning("Could not get Postgres uptime, error: #{err}")