openreplay/scripts/helm/db/init_dbs/postgresql/1.5.99/1.5.99.sql
Taha Yassine Kraiem a140223923 feat(api): cleaned unused custom_metrics endpoints
feat(api): custom_metrics support list of issues
feat(api): custom_metrics support table-pieChart
feat(api): custom_metrics support table-table
feat(api): custom_metrics handle redundant series update
feat(api): custom_metrics default create-values
feat(api): custom_metrics refactored schemas
feat(DB): custom_metrics structure changes
2022-03-02 19:08:15 +01:00

49 lines
No EOL
1.4 KiB
PL/PgSQL

BEGIN;
CREATE OR REPLACE FUNCTION openreplay_version()
RETURNS text AS
$$
SELECT 'v1.5.X'
$$ LANGUAGE sql IMMUTABLE;
UPDATE metrics
SET is_public= TRUE;
DO
$$
BEGIN
IF NOT EXISTS(SELECT *
FROM pg_type typ
INNER JOIN pg_namespace nsp
ON nsp.oid = typ.typnamespace
WHERE nsp.nspname = current_schema()
AND typ.typname = 'metric_type') THEN
CREATE TYPE metric_type AS ENUM ('timeseries','table');
END IF;
END;
$$
LANGUAGE plpgsql;
DO
$$
BEGIN
IF NOT EXISTS(SELECT *
FROM pg_type typ
INNER JOIN pg_namespace nsp
ON nsp.oid = typ.typnamespace
WHERE nsp.nspname = current_schema()
AND typ.typname = 'metric_view_type') THEN
CREATE TYPE metric_view_type AS ENUM ('lineChart','progress','table','pieChart');
END IF;
END;
$$
LANGUAGE plpgsql;
ALTER TABLE metrics
ADD COLUMN IF NOT EXISTS
metric_type metric_type NOT NULL DEFAULT 'timeseries',
ADD COLUMN IF NOT EXISTS
view_type metric_view_type NOT NULL DEFAULT 'lineChart',
ADD COLUMN IF NOT EXISTS
metric_of text NOT NULL DEFAULT 'sessionCount';
COMMIT;