Skip to content

v4.8.0 — PostgreSQL support & configurable DB connection

Choose a tag to compare

@oli217 oli217 released this 14 Sep 06:08
· 21 commits to main since this release
e685317

Fixed

  • PostgreSQL compatibility: boolean columns (is_new_visitor, is_new_page_visit) were compared with = 1/= 0 in raw SQL — MySQL/MariaDB/SQLite accept this, Postgres does not. Fixed with portable CASE WHEN column THEN 1 ELSE 0 END syntax.
  • PostgreSQL: division by zero on bounce_rate in getTopPages() when no row has is_new_page_visit = true. Protected with NULLIF.
  • Heatmap: missing pgsql branch was falling through to MySQL-only HOUR()/DAYOFWEEK() functions. Fixed with EXTRACT() for Postgres.

Added

  • Configurable database connection via statamic-analytics.database_connection (env: ANALYTICS_DB_CONNECTION). Defaults to null (no behavior change for existing installs). Useful when analytics data must live on a specific connection regardless of the app default.
  • CI: added test-postgres job (PostgreSQL 16) mirroring the existing MySQL/MariaDB jobs.

Thanks @trampish (#1)