Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

1.6 KB
Raw Blame
## Create the v_api_key_usage view for API-key usage analytics.
##
## Filename intentionally sorts after 20260907_api_key_usage_analytics.yaml (the table-creation
## migration) so Liquibase — which processes change-log files alphabetically — creates the
## api_key_usage_log table before this view references it.
##
## Client identity + PII are stored on each request row, so v_api_key_usage reads them straight off
## api_key_usage_log. Every join is a LEFT JOIN: api_key_usage_log deliberately has no foreign keys
## on api_key_id / user_id / created_by_id so rows outlive a deleted key or user — an inner join
## would silently drop that history, so api_key_name / creator_display_name / group_name are simply
## NULL once the referenced row is gone.

databaseChangeLog:
  - logicalFilePath: migrations/065_update_migrations.yaml

  - changeSet:
      id: v65.2026-09-10T00:00:10
      author: sfragnaud
      runOnChange: true
      comment: Create v_api_key_usage view for API-key usage analytics
      changes:
        - sqlFile:
            dbms: postgresql
            path: ../instance_analytics_views/api_key_usage/v1/postgres-api_key_usage.sql
            relativeToChangelogFile: true
        - sqlFile:
            dbms: mysql,mariadb
            path: ../instance_analytics_views/api_key_usage/v1/mysql-api_key_usage.sql
            relativeToChangelogFile: true
        - sqlFile:
            dbms: h2
            path: ../instance_analytics_views/api_key_usage/v1/h2-api_key_usage.sql
            relativeToChangelogFile: true
      rollback:
        - sql: DROP VIEW IF EXISTS v_api_key_usage